summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-10-11 05:19:58 -0300
committerLaurenz <laurmaedje@gmail.com>2024-10-15 15:06:36 +0200
commit41d8ecd1c347375256397315594afcf4f2a39ca9 (patch)
tree7883e9202a75bed3e24aa0ff7c27365bf22cc7e0 /tests
parenteea8f13c426c7277a60ed476ebd14dc2c636e8b3 (diff)
Fix hashing of equal decimals with different scales (#5179)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/suite/foundations/decimal.typ7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/suite/foundations/decimal.typ b/tests/suite/foundations/decimal.typ
index d5fd9444..bae0d2e6 100644
--- a/tests/suite/foundations/decimal.typ
+++ b/tests/suite/foundations/decimal.typ
@@ -31,6 +31,13 @@
// Error: 10-19 float is not a valid decimal: float.nan
#decimal(float.nan)
+--- decimal-scale-is-observable ---
+// Ensure equal decimals with different scales produce different strings.
+#let f1(x) = str(x)
+#let f2(x) = f1(x)
+#test(f2(decimal("3.140")), "3.140")
+#test(f2(decimal("3.14000")), "3.14000")
+
--- decimal-repr ---
// Test the `repr` function with decimals.
#test(repr(decimal("12.0")), "decimal(\"12.0\")")