Add test of boolean as a $literal

This commit is contained in:
David Tolnay 2021-12-26 20:25:17 -08:00
parent 445781ee6a
commit da9f24add0
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -229,6 +229,34 @@ fn test_string() {
assert_eq!(expected, tokens.to_string()); assert_eq!(expected, tokens.to_string());
} }
#[test]
fn test_interpolated_literal() {
macro_rules! m {
($literal:literal) => {
quote!($literal)
};
}
let tokens = m!(1);
let expected = "1";
assert_eq!(expected, tokens.to_string());
let tokens = m!(-1);
let expected = "- 1";
assert_eq!(expected, tokens.to_string());
// FIXME
/*
let tokens = m!(true);
let expected = "true";
assert_eq!(expected, tokens.to_string());
let tokens = m!(-true);
let expected = "- true";
assert_eq!(expected, tokens.to_string());
*/
}
#[test] #[test]
fn test_ident() { fn test_ident() {
let foo = Ident::new("Foo", Span::call_site()); let foo = Ident::new("Foo", Span::call_site());