Handle matching no switches.
This commit is contained in:
parent
169bf69f5e
commit
32da06776c
@ -0,0 +1,2 @@
|
|||||||
|
#+begin_example
|
||||||
|
#+end_example
|
@ -1559,13 +1559,21 @@ fn compare_example_block<'b, 's>(
|
|||||||
|
|
||||||
// Compare switches
|
// Compare switches
|
||||||
let switches = get_property_quoted_string(emacs, ":switches")?;
|
let switches = get_property_quoted_string(emacs, ":switches")?;
|
||||||
if switches.as_ref().map(String::as_str) != rust.switches {
|
match (switches.as_ref().map(String::as_str), rust.switches) {
|
||||||
|
(None, None) => {}
|
||||||
|
(Some(""), None) => {}
|
||||||
|
(None, Some("")) => {
|
||||||
|
unreachable!("The organic parser would return a None instead of an empty string.");
|
||||||
|
}
|
||||||
|
(Some(e), Some(r)) if e == r => {}
|
||||||
|
_ => {
|
||||||
this_status = DiffStatus::Bad;
|
this_status = DiffStatus::Bad;
|
||||||
message = Some(format!(
|
message = Some(format!(
|
||||||
"Switches mismatch (emacs != rust) {:?} != {:?}",
|
"Switches mismatch (emacs != rust) {:?} != {:?}",
|
||||||
switches, rust.switches
|
switches, rust.switches
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compare number-lines
|
// Compare number-lines
|
||||||
let number_lines = get_property(emacs, ":number-lines")?;
|
let number_lines = get_property(emacs, ":number-lines")?;
|
||||||
|
@ -326,6 +326,7 @@ fn _lesser_block_begin<'b, 'g, 'r, 's, 'c>(
|
|||||||
Ok((remaining, name))
|
Ok((remaining, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct ExampleSwitches<'s> {
|
struct ExampleSwitches<'s> {
|
||||||
source: &'s str,
|
source: &'s str,
|
||||||
number_lines: Option<SwitchNumberLines>,
|
number_lines: Option<SwitchNumberLines>,
|
||||||
@ -334,6 +335,7 @@ struct ExampleSwitches<'s> {
|
|||||||
label_format: Option<&'s str>,
|
label_format: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
enum SwitchState {
|
enum SwitchState {
|
||||||
Normal,
|
Normal,
|
||||||
NewLineNumber,
|
NewLineNumber,
|
||||||
|
Loading…
Reference in New Issue
Block a user