Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1a81501

Browse files
Show your and expected answers after failed submission + case-insensitive search (clearloop#43)
* feat(output): show your and expected answers after failed submission * fix(search): made it case-insensitive
1 parent b8002b3 commit 1a81501

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎src/cache/models.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ pub struct VerifyResult {
223223
code_answer: Vec<String>,
224224
#[serde(default, deserialize_with = "ssr")]
225225
code_output: Vec<String>,
226+
#[serde(default, deserialize_with = "ssr")]
227+
expected_output: Vec<String>,
226228
#[serde(default)]
227229
std_output: String,
228230

@@ -351,7 +353,7 @@ impl std::fmt::Display for VerifyResult {
351353
// Failed some tests during submission
352354
11 => write!(
353355
f,
354-
"\n{}\n\n{}{}\n{}{}\n{}{}\n",
356+
"\n{}\n\n{}{}\n{}{}\n{}{}{}{}{}{}\n",
355357
&self.status.status_msg.red().bold(),
356358
"Cases passed:".after_spaces(2).green(),
357359
&self
@@ -371,7 +373,11 @@ impl std::fmt::Display for VerifyResult {
371373
.bold()
372374
.yellow(),
373375
&"Last case:".after_spaces(5).dimmed(),
374-
&self.submit.last_testcase.replace("\n", "↩ ").dimmed()
376+
&self.submit.last_testcase.replace("\n", "↩ ").dimmed(),
377+
&"\nOutput:".after_spaces(8),
378+
self.code_output[0],
379+
&"\nExpected:".after_spaces(6),
380+
self.expected_output[0],
375381
)?,
376382
// Output Timeout Exceeded
377383
//

‎src/cmds/list.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ impl Command for ListCommand {
184184

185185
// retain if keyword exists
186186
if let Some(keyword) = m.value_of("keyword") {
187-
ps.retain(|x| x.name.contains(&keyword));
187+
let lowercase_kw = keyword.to_lowercase();
188+
ps.retain(|x| x.name.to_lowercase().contains(&lowercase_kw));
188189
}
189190

190191
let out: Vec<String> = ps.iter().map(ToString::to_string).collect();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /