From 7e07b61046ec43369fb8f2e281b71c4e5988f5fc Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 30 May 2023 18:05:15 +0200 Subject: Add a base parameter to str() (#1362) --- tests/typ/compute/construct.typ | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/typ') 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) @@ -71,6 +74,14 @@ // Error: 6-8 expected integer, float, label, or string, found content #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)) -- cgit v1.2.3