Skip to content

Commit

Permalink
Add tests of negative literal construction
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 14, 2024
1 parent c61f5db commit 28c87ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,22 @@ fn literal_integer() {
assert_eq!(Literal::i64_unsuffixed(10).to_string(), "10");
assert_eq!(Literal::i128_unsuffixed(10).to_string(), "10");
assert_eq!(Literal::isize_unsuffixed(10).to_string(), "10");

assert_eq!(Literal::i32_suffixed(-10).to_string(), "-10i32");
assert_eq!(Literal::i32_unsuffixed(-10).to_string(), "-10");
}

#[test]
fn literal_float() {
assert_eq!(Literal::f32_suffixed(10.0).to_string(), "10f32");
assert_eq!(Literal::f32_suffixed(-10.0).to_string(), "-10f32");
assert_eq!(Literal::f64_suffixed(10.0).to_string(), "10f64");
assert_eq!(Literal::f64_suffixed(-10.0).to_string(), "-10f64");

assert_eq!(Literal::f32_unsuffixed(10.0).to_string(), "10.0");
assert_eq!(Literal::f32_unsuffixed(-10.0).to_string(), "-10.0");
assert_eq!(Literal::f64_unsuffixed(10.0).to_string(), "10.0");
assert_eq!(Literal::f64_unsuffixed(-10.0).to_string(), "-10.0");
}

#[test]
Expand Down

0 comments on commit 28c87ad

Please sign in to comment.