Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanbohan committed Nov 9, 2023
1 parent 8028359 commit 9cffca2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions src/label/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,19 +530,19 @@ mod tests {

#[test]
fn test_convert_re() {
assert_eq!(try_escape_for_repeat_re("abc{}"), r#"abc\{}"#);
assert_eq!(try_escape_for_repeat_re("abc{def}"), r#"abc\{def}"#);
assert_eq!(try_escape_for_repeat_re("abc{def"), r#"abc\{def"#);
assert_eq!(try_escape_for_repeat_re("abc{}"), r"abc\{}");
assert_eq!(try_escape_for_repeat_re("abc{def}"), r"abc\{def}");
assert_eq!(try_escape_for_repeat_re("abc{def"), r"abc\{def");
assert_eq!(try_escape_for_repeat_re("abc{1}"), "abc{1}");
assert_eq!(try_escape_for_repeat_re("abc{1,}"), "abc{1,}");
assert_eq!(try_escape_for_repeat_re("abc{1,2}"), "abc{1,2}");
assert_eq!(try_escape_for_repeat_re("abc{,2}"), r#"abc\{,2}"#);
assert_eq!(try_escape_for_repeat_re("abc{{1,2}}"), r#"abc\{{1,2}}"#);
assert_eq!(try_escape_for_repeat_re(r#"abc\{abc"#), r#"abc\{abc"#);
assert_eq!(try_escape_for_repeat_re("abc{1a}"), r#"abc\{1a}"#);
assert_eq!(try_escape_for_repeat_re("abc{1,a}"), r#"abc\{1,a}"#);
assert_eq!(try_escape_for_repeat_re("abc{1,2a}"), r#"abc\{1,2a}"#);
assert_eq!(try_escape_for_repeat_re("abc{1,2,3}"), r#"abc\{1,2,3}"#);
assert_eq!(try_escape_for_repeat_re("abc{1,,2}"), r#"abc\{1,,2}"#);
assert_eq!(try_escape_for_repeat_re("abc{,2}"), r"abc\{,2}");
assert_eq!(try_escape_for_repeat_re("abc{{1,2}}"), r"abc\{{1,2}}");
assert_eq!(try_escape_for_repeat_re(r#"abc\{abc"#), r"abc\{abc");
assert_eq!(try_escape_for_repeat_re("abc{1a}"), r"abc\{1a}");
assert_eq!(try_escape_for_repeat_re("abc{1,a}"), r"abc\{1,a}");
assert_eq!(try_escape_for_repeat_re("abc{1,2a}"), r"abc\{1,2a}");
assert_eq!(try_escape_for_repeat_re("abc{1,2,3}"), r"abc\{1,2,3}");
assert_eq!(try_escape_for_repeat_re("abc{1,,2}"), r"abc\{1,,2}");
}
}
14 changes: 7 additions & 7 deletions src/parser/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ mod tests {
Expr::from(r#"double-quoted string \" with escaped quote"#),
),
(
r#"'single-quoted string \' with escaped quote'"#,
Expr::from(r#"single-quoted string \' with escaped quote"#),
r"'single-quoted string \' with escaped quote'",
Expr::from(r"single-quoted string \' with escaped quote"),
),
(
"`backtick-quoted string`",
Expand All @@ -139,18 +139,18 @@ mod tests {
Expr::from(r#"\a\b\f\n\r\t\v\\\" - \xFF\377\u1234\U00010111\U0001011111☺"#),
),
(
r#"'\a\b\f\n\r\t\v\\\' - \xFF\377\u1234\U00010111\U0001011111☺'"#,
Expr::from(r#"\a\b\f\n\r\t\v\\\' - \xFF\377\u1234\U00010111\U0001011111☺"#),
r"'\a\b\f\n\r\t\v\\\' - \xFF\377\u1234\U00010111\U0001011111☺'",
Expr::from(r"\a\b\f\n\r\t\v\\\' - \xFF\377\u1234\U00010111\U0001011111☺"),
),
(
r#"`\a\b\f\n\r\t\v\\\` - \xFF\377\u1234\U00010111\U0001011111☺`"#,
Expr::from(r#"\a\b\f\n\r\t\v\\\` - \xFF\377\u1234\U00010111\U0001011111☺"#),
r"`\a\b\f\n\r\t\v\\\` - \xFF\377\u1234\U00010111\U0001011111☺`",
Expr::from(r"\a\b\f\n\r\t\v\\\` - \xFF\377\u1234\U00010111\U0001011111☺"),
),
];
assert_cases(Case::new_expr_cases(cases));

let fail_cases = vec![
(r#"`\\``"#, "unterminated quoted string `"),
(r"`\\``", "unterminated quoted string `"),
(r#""\"#, "escape sequence not terminated"),
(r#""\c""#, "unknown escape sequence 'c'"),
// (r#""\x.""#, ""),
Expand Down
4 changes: 2 additions & 2 deletions src/parser/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ mod tests {
assert!(matches!(get_keyword_token("nan"), Some(T_NUMBER)));

// not keywords
assert!(matches!(get_keyword_token("at"), None));
assert!(matches!(get_keyword_token("unknown"), None));
assert!(get_keyword_token("at").is_none());
assert!(get_keyword_token("unknown").is_none());
}

#[test]
Expand Down

0 comments on commit 9cffca2

Please sign in to comment.