diff options
author | David Tolnay <dtolnay@gmail.com> | 2019-04-22 16:15:14 -0700 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2019-04-22 16:15:14 -0700 |
commit | e4482f4734056bc2853c2f3b19c38bf3cd81c5cd (patch) | |
tree | 78a2c8a3a76153259d8f8e254f75e5366d530127 /tests/test.rs | |
parent | 219b1d3d4d73fc645e4dcd8a01e387ee157a6a35 (diff) | |
download | proc-macro2-e4482f4734056bc2853c2f3b19c38bf3cd81c5cd.tar.gz |
Avoid needless escape of quotes
Diffstat (limited to 'tests/test.rs')
-rw-r--r-- | tests/test.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test.rs b/tests/test.rs index f5660c0..370392b 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -80,9 +80,21 @@ fn lifetime_invalid() { } #[test] -fn literals() { +fn literal_string() { assert_eq!(Literal::string("foo").to_string(), "\"foo\""); assert_eq!(Literal::string("\"").to_string(), "\"\\\"\""); + assert_eq!(Literal::string("didn't").to_string(), "\"didn't\""); +} + +#[test] +fn literal_character() { + assert_eq!(Literal::character('x').to_string(), "'x'"); + assert_eq!(Literal::character('\'').to_string(), "'\\''"); + assert_eq!(Literal::character('"').to_string(), "'\"'"); +} + +#[test] +fn literal_float() { assert_eq!(Literal::f32_unsuffixed(10.0).to_string(), "10.0"); } |