summary refs log tree commit diff stats
path: root/tests/lexer/tunary_minus.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-03-27 12:03:14 -0700
committerGitHub <noreply@github.com>2021-03-27 12:03:14 -0700
commitbbe4cf4703903081553fe066ece5a57a5f190493 (patch)
treef52e123284dc4fe6b7e20ab08a419e2ad9cef10d /tests/lexer/tunary_minus.nim
parentd3705b253c155a6f129a7f26ea9435a0ab45143f (diff)
downloadNim-bbe4cf4703903081553fe066ece5a57a5f190493.tar.gz
followup custom literals (#17500)
Diffstat (limited to 'tests/lexer/tunary_minus.nim')
-rw-r--r--tests/lexer/tunary_minus.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/lexer/tunary_minus.nim b/tests/lexer/tunary_minus.nim
index 639911fcd..87b3cb52d 100644
--- a/tests/lexer/tunary_minus.nim
+++ b/tests/lexer/tunary_minus.nim
@@ -51,8 +51,17 @@ template main =
     doAssert x() == minusOne:
       "unable to handle negatives after semi-colon"
 
+  block:
     doAssert -0b111 == -7
     doAssert -0xff == -255
+    doAssert -128'i8 == (-128).int8
+    doAssert $(-128'i8) == "-128"
+    doAssert -32768'i16 == int16.low
+    doAssert -2147483648'i32 == int32.low
+    when int.sizeof > 4:
+      doAssert -9223372036854775808 == int.low
+    when not defined(js):
+      doAssert -9223372036854775808 == int64.low
 
   block: # check when a minus (-) is an unary op
     doAssert -one == minusOne:
@@ -68,6 +77,5 @@ template main =
     doAssert 4 - one == 3:
       "unable to handle subtraction with surrounding spaces with an identifier"
 
-
 static: main()
 main()