mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-17 07:54:45 +00:00
#6040: pin merged feature catalogs and handle escaped character literals
This commit is contained in:
1 parent
3c77297b83
commit
0cc92c9744
2 files changed
+11
-1
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
1e515422afdda2f317af430c1f9d68a5f83935b4
|
||||
e56d26244bbac099bfd42e23fb12f78a4be418a7
|
||||
@@ -94,6 +94,8 @@ fn literals(source: &str) -> Vec<String> {
|
||||
if !test_module {
|
||||
out.push(text);
|
||||
}
|
||||
} else if chars[at] == '\'' && chars.get(at + 1) == Some(&'\\') && chars.get(at + 3) == Some(&'\'') {
|
||||
at += 4; // An escaped character literal must not start a string.
|
||||
} else if chars[at] == '\'' && chars.get(at + 2) == Some(&'\'') {
|
||||
at += 3; // A character literal such as '"', not the start of a string.
|
||||
} else {
|
||||
@@ -181,3 +183,11 @@ fn guard_scans_production_after_test_only_items_and_parses_raw_labels() {
|
||||
assert!(literals(source).iter().any(|label| banned_display(label)));
|
||||
assert_eq!(literals("#[cfg(test)] mod tests; fn live() { let _ = \"SmartArt\"; }"), ["SmartArt"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guard_skips_escaped_character_literals_without_hiding_labels() {
|
||||
let source = r#"let quote = '\"'; let label = "WordArt"; // "ignored""#;
|
||||
assert_eq!(literals(source), ["WordArt"]);
|
||||
assert!(literals(source).iter().any(|label| banned_display(label)));
|
||||
assert_eq!(literals(r#"let quote = '\"'; // "WordArt""#), Vec::<String>::new());
|
||||
}
|
||||
Reference in new issue
Block a user