summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-18 16:27:16 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-18 16:27:16 +0200
commit1ce2425c0efe2c8ce245d62adb3001040e44d0ab (patch)
tree005801e6ba23ba87e7060bbf41ee2bea98c87b5e /modules/gdscript/tests
parent11ee6fcef06beea2a2ff2214003e71a45875a695 (diff)
parentd15511725acdfe90f9d5967119294b591becd8fa (diff)
downloadredot-engine-1ce2425c0efe2c8ce245d62adb3001040e44d0ab.tar.gz
Merge pull request #73363 from dalexeev/gds-fix-min-int-not-representable
GDScript: Fix `MIN_INT` not representable as numeric literal
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.gd17
-rw-r--r--modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.out16
2 files changed, 33 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.gd b/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.gd
new file mode 100644
index 0000000000..cf7fb1518c
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.gd
@@ -0,0 +1,17 @@
+func test():
+ print(-9223372036854775808 == (1 << 63))
+ print(-2)
+ print(- 2)
+ print(---2)
+ print(3 - 2)
+ print(3-2)
+ print(3---2)
+ print(-3 - 2)
+ print(-3 - -2)
+ print(-(3 - 2)-2)
+ print([1, 2, 3][0]-1)
+ var t = 1
+ print(t-1)
+ print(-0xFF)
+ print(1--0xFF)
+ print(floor(PI-1))
diff --git a/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.out b/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.out
new file mode 100644
index 0000000000..c5958365ec
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/number_literals_with_sign.out
@@ -0,0 +1,16 @@
+GDTEST_OK
+true
+-2
+-2
+-2
+1
+1
+1
+-5
+-1
+-3
+0
+0
+-255
+256
+2