From 0c0d11941352936aacaa6cfb28e5b9557f0b3db3 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Tue, 11 Mar 2025 11:50:33 +0100 Subject: [PATCH] test: printf: Add a test for scientific printing of negative number This was broken before the last few commits. --- tests/by-util/test_printf.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index 098218d6c..f33959ea0 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -380,6 +380,14 @@ fn sub_num_dec_trunc() { .stdout_only("pi is ~ 3.14159"); } +#[test] +fn sub_num_sci_negative() { + new_ucmd!() + .args(&["-1234 is %e", "-1234"]) + .succeeds() + .stdout_only("-1234 is -1.234000e+03"); +} + #[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] fn sub_num_hex_float_lower() {