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