Skip to content

Commit

Permalink
Add test of escape characters
Browse files Browse the repository at this point in the history
Summary: Our escape characters are not implemented as per the Starlark spec, and the Starlark spec isn't very complete. I've raised bazelbuild/starlark#160 to get more details in the spec, but the temptation is to just follow the Python character escaping spec.

Reviewed By: bobyangyf

Differential Revision: D26276328

fbshipit-source-id: c50a2a677707257a9b481a45a65343cd109cf715
  • Loading branch information
ndmitchell authored and facebook-github-bot committed Feb 6, 2021
1 parent 9643ea1 commit 2529ace
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions starlark/src/eval/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,21 @@ assert_eq(r, [1,2,3,4,5])
);
}

#[test]
// FIXME: All of these tests are broken with either compile-time or runtime failures.
// Our lexing needs some work.
#[ignore]
fn test_escape_characters() {
assert_eq!(
assert::pass(r#"'\a\b\f\n\r\t\v'"#).to_string(),
"\x07\x08\x0C\x0A\x0D\x09\x0B"
);
assert_eq!(assert::pass(r#"\0"#).to_string(), "\x00");
assert_eq!(assert::pass(r#"\12"#).to_string(), "\n");
assert_eq!(assert::pass(r#"\101-\132"#).to_string(), "A-Z");
assert_eq!(assert::pass(r#"\119"#).to_string(), "\t9");
}

#[test]
fn test_deallocation() {
// Check that we really do deallocate values we create
Expand Down

0 comments on commit 2529ace

Please sign in to comment.