Skip to content

Commit

Permalink
Use a character other than \0 for testing unicode escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 28, 2022
1 parent 0ec6e20 commit 678d83d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test.rs
Expand Up @@ -200,7 +200,7 @@ fn test_floating() {

#[test]
fn test_char() {
let zero = '\0';
let zero = '\u{1}';
let pound = '#';
let quote = '"';
let apost = '\'';
Expand All @@ -210,23 +210,23 @@ fn test_char() {
let tokens = quote! {
#zero #pound #quote #apost #newline #heart
};
let expected = "'\\u{0}' '#' '\"' '\\'' '\\n' '\u{2764}'";
let expected = "'\\u{1}' '#' '\"' '\\'' '\\n' '\u{2764}'";
assert_eq!(expected, tokens.to_string());
}

#[test]
fn test_str() {
let s = "\0 a 'b \" c";
let s = "\u{1} a 'b \" c";
let tokens = quote!(#s);
let expected = "\"\\u{0} a 'b \\\" c\"";
let expected = "\"\\u{1} a 'b \\\" c\"";
assert_eq!(expected, tokens.to_string());
}

#[test]
fn test_string() {
let s = "\0 a 'b \" c".to_string();
let s = "\u{1} a 'b \" c".to_string();
let tokens = quote!(#s);
let expected = "\"\\u{0} a 'b \\\" c\"";
let expected = "\"\\u{1} a 'b \\\" c\"";
assert_eq!(expected, tokens.to_string());
}

Expand Down

0 comments on commit 678d83d

Please sign in to comment.