MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / raw_string_does_not_interpret_escapes

Function raw_string_does_not_interpret_escapes

cel/src/parser/parse.rs:494–524  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

492
493 #[test]
494 fn raw_string_does_not_interpret_escapes() {
495 let tests: Vec<(&str, Result<String, ParseSequenceError>)> = vec![
496 // Raw string in double quotes
497 // r"Hello \a \" ' \' \U0001f431 " => Hello \a " ' \' \U0001f431
498 // R"Hello \a \" ' \' \U0001f431 " => Hello \a " ' \' \U0001f431
499 (
500 "r\"Hello \\a \\\" ' \\' \\U0001f431 \"",
501 Ok(String::from("Hello \\a \" ' \\' \\U0001f431 ")),
502 ),
503 (
504 "R\"Hello \\a \\\" ' \\' \\U0001f431 \"",
505 Ok(String::from("Hello \\a \" ' \\' \\U0001f431 ")),
506 ),
507 // Raw string in single quotes
508 // r'Hello \a \" " \' \U0001f431 ' => Hello \a \" " ' \U0001f431
509 // R'Hello \a \" " \' \U0001f431 ' => Hello \a \" " ' \U0001f431
510 (
511 "r'Hello \\a \\\" \" \\' \\U0001f431 '",
512 Ok(String::from("Hello \\a \\\" \" ' \\U0001f431 ")),
513 ),
514 (
515 "R'Hello \\a \\\" \" \\' \\U0001f431 '",
516 Ok(String::from("Hello \\a \\\" \" ' \\U0001f431 ")),
517 ),
518 ];
519
520 for (s, expected) in tests {
521 let result = parse_string(s);
522 assert_eq!(result, expected, "Testing {s}");
523 }
524 }
525
526 #[test]
527 fn parses_bytes() {

Callers

nothing calls this directly

Calls 1

parse_stringFunction · 0.85

Tested by

no test coverage detected