Skip to content

Commit db0e40f

Browse files
committed
Add unit test to confirm negative integer literals work without quotation marks
Fixes #244
1 parent 3ee36d9 commit db0e40f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/from_meta.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,12 @@ mod tests {
842842
assert_eq!(fm::<u32>(quote!(ignore = 5000i32)), 5000u32);
843843
}
844844

845+
#[test]
846+
fn negative_int_without_quotes() {
847+
assert_eq!(fm::<i8>(quote!(ignore = -2)), -2i8);
848+
assert_eq!(fm::<i32>(quote!(ignore = -255)), -255i32);
849+
}
850+
845851
#[test]
846852
#[allow(clippy::float_cmp)] // we want exact equality
847853
fn float_without_quotes() {

0 commit comments

Comments
 (0)