summaryrefslogtreecommitdiff
path: root/tests/typ/compute
diff options
context:
space:
mode:
authorLynn <lynn@foldr.moe>2023-05-30 18:05:15 +0200
committerGitHub <noreply@github.com>2023-05-30 18:05:15 +0200
commit7e07b61046ec43369fb8f2e281b71c4e5988f5fc (patch)
tree89f5f50440f59171598145cd739a4f5029636e1b /tests/typ/compute
parente2bf2327b53a6b963f7adaeb655fefc1d5fac745 (diff)
Add a base parameter to str() (#1362)
Diffstat (limited to 'tests/typ/compute')
-rw-r--r--tests/typ/compute/construct.typ11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/typ/compute/construct.typ b/tests/typ/compute/construct.typ
index 9c05a6d0..aea15b53 100644
--- a/tests/typ/compute/construct.typ
+++ b/tests/typ/compute/construct.typ
@@ -64,6 +64,9 @@
---
// Test conversion to string.
#test(str(123), "123")
+#test(str(123, base: 3), "11120")
+#test(str(-123, base: 16), "-7b")
+#test(str(9223372036854775807, base: 36), "1y2p0ij32e8e7")
#test(str(50.14), "50.14")
#test(str(10 / 3).len() > 10, true)
@@ -72,6 +75,14 @@
#str([])
---
+// Error: 17-19 base must be between 2 and 36
+#str(123, base: 99)
+
+---
+// Error: 18-19 base is only supported for integers
+#str(1.23, base: 2)
+
+---
#assert(range(2, 5) == (2, 3, 4))
---