Make a more meaningful test for Punct eq

This commit is contained in:
David Tolnay 2021-04-29 11:20:27 -07:00
parent 3c16c0e1df
commit faad7e209d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1,4 +1,4 @@
use proc_macro::{LineColumn, Punct}; use proc_macro::{LineColumn, Punct, Spacing};
pub fn test() { pub fn test() {
test_line_column_ord(); test_line_column_ord();
@ -14,8 +14,8 @@ fn test_line_column_ord() {
} }
fn test_punct_eq() { fn test_punct_eq() {
// Good enough if it typechecks, since proc_macro::Punct can't exist in a test. let colon_alone = Punct::new(':', Spacing::Alone);
fn _check(punct: Punct) { assert_eq!(colon_alone, ':');
let _ = punct == ':'; let colon_joint = Punct::new(':', Spacing::Joint);
} assert_eq!(colon_joint, ':');
} }