diff --git a/cli/src/test.rs b/cli/src/test.rs index a6773d78..7690bdd3 100644 --- a/cli/src/test.rs +++ b/cli/src/test.rs @@ -27,7 +27,7 @@ lazy_static! { (?P(?:=+){3,}) (?P[^=\r\n][^\r\n]*)? \r?\n - (?P(?:[^=][^\r\n]*\r?\n)+) + (?P(?:([^=\r\n]|\s+:)[^\r\n]*\r?\n)+) ===+ (?P[^=\r\n][^\r\n]*)?\r?\n" ) @@ -1242,7 +1242,27 @@ NOT A TEST HEADER ---asdf\()[]|{}*+?^$.- (a) - " + +==============================asdf\()[]|{}*+?^$.- +Test containing equals +==============================asdf\()[]|{}*+?^$.- + +=== + +------------------------------asdf\()[]|{}*+?^$.- + +(a) + +==============================asdf\()[]|{}*+?^$.- +Subsequent test containing equals +==============================asdf\()[]|{}*+?^$.- + +=== + +------------------------------asdf\()[]|{}*+?^$.- + +(a) +" .trim(), None, ); @@ -1252,7 +1272,7 @@ NOT A TEST HEADER =========================\n\ -------------------------\n" .to_vec(); - assert_eq!( + pretty_assertions::assert_eq!( entry, TestEntry::Group { name: "the-filename".to_string(), @@ -1286,6 +1306,26 @@ NOT A TEST HEADER has_fields: false, attributes_str: String::new(), attributes: TestAttributes::default(), + }, + TestEntry::Example { + name: "Test containing equals".to_string(), + input: "\n===\n".into(), + output: "(a)".into(), + header_delim_len: 30, + divider_delim_len: 30, + has_fields: false, + attributes_str: String::new(), + attributes: TestAttributes::default(), + }, + TestEntry::Example { + name: "Subsequent test containing equals".to_string(), + input: "\n===\n".into(), + output: "(a)".into(), + header_delim_len: 30, + divider_delim_len: 30, + has_fields: false, + attributes_str: String::new(), + attributes: TestAttributes::default(), } ], file_path: None, @@ -1406,6 +1446,7 @@ a ============================= Test with bad platform marker :platform({}) + :language(foo) ============================= a @@ -1452,9 +1493,9 @@ a divider_delim_len: 3, has_fields: false, attributes_str: if std::env::consts::OS == "linux" { - ":platform(macos)\n:language(foo)".to_string() + ":platform(macos)\n\n:language(foo)".to_string() } else { - ":platform(linux)\n:language(foo)".to_string() + ":platform(linux)\n\n:language(foo)".to_string() }, attributes: TestAttributes { skip: false,