Skip to content

Commit c3870f1

Browse files
committed
Add raw identifier Debug test
1 parent 0bc70ca commit c3870f1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/test.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,19 @@ fn test_display_ident() {
719719
#[test]
720720
fn test_debug_ident() {
721721
let ident = Ident::new("proc_macro", Span::call_site());
722+
let expected = if cfg!(span_locations) {
723+
"Ident { sym: proc_macro }"
724+
} else {
725+
"Ident(proc_macro)"
726+
};
727+
assert_eq!(expected, format!("{:?}", ident));
722728

723-
#[cfg(not(span_locations))]
724-
let expected = "Ident(proc_macro)";
725-
726-
#[cfg(span_locations)]
727-
let expected = "Ident { sym: proc_macro }";
728-
729+
let ident = Ident::new_raw("proc_macro", Span::call_site());
730+
let expected = if cfg!(span_locations) {
731+
"Ident { sym: r#proc_macro }"
732+
} else {
733+
"Ident(r#proc_macro)"
734+
};
729735
assert_eq!(expected, format!("{:?}", ident));
730736
}
731737

0 commit comments

Comments
 (0)