From 28c87ad85264b055b9512c71d1aee4af7353bec4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 14 Apr 2024 14:21:03 -0700 Subject: [PATCH] Add tests of negative literal construction --- tests/test.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index bf17435..6343023 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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]