about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/thousands/tests.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-31 12:28:20 +0100
committerGitHub <noreply@github.com>2025-01-31 12:28:20 +0100
commit95f746d2ef188fa4e68ca3bfbe03332a1fa802a0 (patch)
tree6dd38dca2fb51ac71c54f3b03c975513db19d6e0 /compiler/rustc_data_structures/src/thousands/tests.rs
parent417aa6c1f60098d3b5d102aeb3bfa246259b7b35 (diff)
parent0c470910061c9ad379b1cbf8a74315bc1a9b3c74 (diff)
downloadrust-95f746d2ef188fa4e68ca3bfbe03332a1fa802a0.tar.gz
rust-95f746d2ef188fa4e68ca3bfbe03332a1fa802a0.zip
Rollup merge of #136336 - nnethercote:overhaul-rustc_middle-util, r=jieyouxu
Overhaul `rustc_middle::util`

It's an odd module with some odd stuff in it.

r? `@Noratrieb`
Diffstat (limited to 'compiler/rustc_data_structures/src/thousands/tests.rs')
-rw-r--r--compiler/rustc_data_structures/src/thousands/tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/thousands/tests.rs b/compiler/rustc_data_structures/src/thousands/tests.rs
new file mode 100644
index 00000000000..906605d9a93
--- /dev/null
+++ b/compiler/rustc_data_structures/src/thousands/tests.rs
@@ -0,0 +1,14 @@
+use super::*;
+
+#[test]
+fn test_format_with_underscores() {
+    assert_eq!("0", format_with_underscores(0));
+    assert_eq!("1", format_with_underscores(1));
+    assert_eq!("99", format_with_underscores(99));
+    assert_eq!("345", format_with_underscores(345));
+    assert_eq!("1_000", format_with_underscores(1_000));
+    assert_eq!("12_001", format_with_underscores(12_001));
+    assert_eq!("999_999", format_with_underscores(999_999));
+    assert_eq!("1_000_000", format_with_underscores(1_000_000));
+    assert_eq!("12_345_678", format_with_underscores(12_345_678));
+}