use super::*;
#[test]
fn mask_strings_basic() {
assert_eq!(
mask_strings(r#"let s = "if x > 0";"#, &[]),
r#"let s = " ";"#
);
assert_eq!(
mask_strings(r#"let c = '{'; if x {"#, &[]),
r#"let c = ' '; if x {"#
);
assert_eq!(
mask_strings(r#"let s = "he said \"hi\"";"#, &[]),
r#"let s = " ";"#
);
}
#[test]
fn mask_strings_empty() {
assert_eq!(mask_strings("", &[]), "");
}
#[test]
fn mask_strings_no_strings() {
assert_eq!(mask_strings("let x = 42;", &[]), "let x = 42;");
}
#[test]
fn mask_strings_raw_string() {
let result = mask_strings(r#"x = r"if|for|while""#, &[]);
assert!(!result.contains("if|for|while"));
assert!(result.contains("r")); }
#[test]
fn mask_strings_unclosed_string() {
assert_eq!(mask_strings(r#"let s = "hello"#, &[]), r#"let s = " "#);
}
#[test]
fn mask_strings_with_line_comment() {
assert_eq!(
mask_strings("x = 5; // don't do this", &["//"]),
"x = 5; "
);
}
#[test]
fn mask_strings_comment_after_string() {
assert_eq!(
mask_strings(r#"x = "hello"; // it's ok"#, &["//"]),
r#"x = " "; "#
);
}
#[test]
fn mask_strings_comment_marker_inside_string() {
assert_eq!(
mask_strings(r#"x = "http://foo"; if y"#, &["//"]),
r#"x = " "; if y"#
);
}