diff options
author | Danil Alexeev <danil@alexeev.xyz> | 2023-02-13 09:46:31 +0300 |
---|---|---|
committer | Danil Alexeev <danil@alexeev.xyz> | 2023-06-14 21:47:12 +0300 |
commit | fba8cbe6dbf17399e06ac9141a862734187dfb65 (patch) | |
tree | 7a48d44a48059c7b5d9bfa3e575b32637f3870cc /modules/gdscript/tests/scripts/parser/features | |
parent | 33957aee69683cf1f542a8622e5a9efd23070f1c (diff) | |
download | redot-engine-fba8cbe6dbf17399e06ac9141a862734187dfb65.tar.gz |
GDScript: Fix repeated `_` are allowed after decimal point
Diffstat (limited to 'modules/gdscript/tests/scripts/parser/features')
-rw-r--r-- | modules/gdscript/tests/scripts/parser/features/number_separators.gd | 32 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/parser/features/number_separators.out | 23 |
2 files changed, 46 insertions, 9 deletions
diff --git a/modules/gdscript/tests/scripts/parser/features/number_separators.gd b/modules/gdscript/tests/scripts/parser/features/number_separators.gd index f5f5661cae..a534c4fde1 100644 --- a/modules/gdscript/tests/scripts/parser/features/number_separators.gd +++ b/modules/gdscript/tests/scripts/parser/features/number_separators.gd @@ -1,12 +1,26 @@ func test(): # `_` can be used as a separator for numbers in GDScript. # It can be placed anywhere in the number, except at the beginning. - # Currently, GDScript in the `master` branch only allows using one separator - # per number. - # Results are assigned to variables to avoid warnings. - var __ = 1_23 - __ = 123_ # Trailing number separators are OK. - __ = 12_3 - __ = 123_456 - __ = 0x1234_5678 - __ = 0b1001_0101 + print(1_23) + print(12_3) + print(1_2_3) + print(123_) # Trailing number separators are OK. + print(123_456) + print(123_45_6_) + print("---") + print(0x1234_00ff) + print(0x1234_00_f_f_) + print(0b1001_0101) + print(0b1001_01_0_1_) + print("---") + print(-1_234.456_7) + print(-1_23_4_.4_56_7_) + print(-1_234.) + print(-1_23_4_.) + print(.456_7) + print(.4_56_7_) + print("---") + print(-1_234.5e000_3) + print(-1_23_4_.5e0_00_3_) + print(-1_234.5e+000_3) + print(-1_23_4_.5e+0_00_3_) diff --git a/modules/gdscript/tests/scripts/parser/features/number_separators.out b/modules/gdscript/tests/scripts/parser/features/number_separators.out index d73c5eb7cd..b0d2fd94fe 100644 --- a/modules/gdscript/tests/scripts/parser/features/number_separators.out +++ b/modules/gdscript/tests/scripts/parser/features/number_separators.out @@ -1 +1,24 @@ GDTEST_OK +123 +123 +123 +123 +123456 +123456 +--- +305398015 +305398015 +149 +149 +--- +-1234.4567 +-1234.4567 +-1234 +-1234 +0.4567 +0.4567 +--- +-1234500 +-1234500 +-1234500 +-1234500 |