summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2023-11-12 11:13:31 +0900
committergit <svn-admin@ruby-lang.org>2023-11-12 02:34:02 +0000
commit2fb1d374393da45f4931cbbc7e573e37ca97e00a (patch)
treeca97fb577b762258a07f43a210782c58ab04ce2b /test
parente6916f13051ef0eebc223beb09a5f328a608c150 (diff)
[ruby/prism] Reject invalid rational literals like `1e1r` on lexing
Fix https://github.com/ruby/prism/pull/1586 https://github.com/ruby/prism/commit/b3bde866f2
Diffstat (limited to 'test')
-rw-r--r--test/prism/fixtures/numbers.txt4
-rw-r--r--test/prism/snapshots/numbers.txt58
2 files changed, 36 insertions, 26 deletions
diff --git a/test/prism/fixtures/numbers.txt b/test/prism/fixtures/numbers.txt
index 3c8bf07805..47f20dcb42 100644
--- a/test/prism/fixtures/numbers.txt
+++ b/test/prism/fixtures/numbers.txt
@@ -44,10 +44,14 @@
1ri
+1.2r
+
1.2ri
-1ri
+-1.2r
+
-1.2ri
0o1r
diff --git a/test/prism/snapshots/numbers.txt b/test/prism/snapshots/numbers.txt
index ca31480f67..c27f2a6354 100644
--- a/test/prism/snapshots/numbers.txt
+++ b/test/prism/snapshots/numbers.txt
@@ -1,8 +1,8 @@
-@ ProgramNode (location: (1,0)-(63,5))
+@ ProgramNode (location: (1,0)-(67,5))
├── locals: []
└── statements:
- @ StatementsNode (location: (1,0)-(63,5))
- └── body: (length: 32)
+ @ StatementsNode (location: (1,0)-(67,5))
+ └── body: (length: 34)
├── @ IntegerNode (location: (1,0)-(1,1))
│ └── flags: decimal
├── @ IntegerNode (location: (3,0)-(3,1))
@@ -56,47 +56,53 @@
│ └── numeric:
│ @ IntegerNode (location: (45,0)-(45,1))
│ └── flags: decimal
- ├── @ ImaginaryNode (location: (47,0)-(47,5))
+ ├── @ RationalNode (location: (47,0)-(47,4))
│ └── numeric:
- │ @ RationalNode (location: (47,0)-(47,4))
+ │ @ FloatNode (location: (47,0)-(47,3))
+ ├── @ ImaginaryNode (location: (49,0)-(49,5))
+ │ └── numeric:
+ │ @ RationalNode (location: (49,0)-(49,4))
│ └── numeric:
- │ @ FloatNode (location: (47,0)-(47,3))
- ├── @ ImaginaryNode (location: (49,0)-(49,4))
+ │ @ FloatNode (location: (49,0)-(49,3))
+ ├── @ ImaginaryNode (location: (51,0)-(51,4))
│ └── numeric:
- │ @ RationalNode (location: (49,0)-(49,3))
+ │ @ RationalNode (location: (51,0)-(51,3))
│ └── numeric:
- │ @ IntegerNode (location: (49,0)-(49,2))
+ │ @ IntegerNode (location: (51,0)-(51,2))
│ └── flags: decimal
- ├── @ ImaginaryNode (location: (51,0)-(51,6))
+ ├── @ RationalNode (location: (53,0)-(53,5))
+ │ └── numeric:
+ │ @ FloatNode (location: (53,0)-(53,4))
+ ├── @ ImaginaryNode (location: (55,0)-(55,6))
│ └── numeric:
- │ @ RationalNode (location: (51,0)-(51,5))
+ │ @ RationalNode (location: (55,0)-(55,5))
│ └── numeric:
- │ @ FloatNode (location: (51,0)-(51,4))
- ├── @ RationalNode (location: (53,0)-(53,4))
+ │ @ FloatNode (location: (55,0)-(55,4))
+ ├── @ RationalNode (location: (57,0)-(57,4))
│ └── numeric:
- │ @ IntegerNode (location: (53,0)-(53,3))
+ │ @ IntegerNode (location: (57,0)-(57,3))
│ └── flags: octal
- ├── @ ImaginaryNode (location: (55,0)-(55,4))
+ ├── @ ImaginaryNode (location: (59,0)-(59,4))
│ └── numeric:
- │ @ IntegerNode (location: (55,0)-(55,3))
+ │ @ IntegerNode (location: (59,0)-(59,3))
│ └── flags: octal
- ├── @ ImaginaryNode (location: (57,0)-(57,5))
+ ├── @ ImaginaryNode (location: (61,0)-(61,5))
│ └── numeric:
- │ @ RationalNode (location: (57,0)-(57,4))
+ │ @ RationalNode (location: (61,0)-(61,4))
│ └── numeric:
- │ @ IntegerNode (location: (57,0)-(57,3))
+ │ @ IntegerNode (location: (61,0)-(61,3))
│ └── flags: octal
- ├── @ RationalNode (location: (59,0)-(59,4))
+ ├── @ RationalNode (location: (63,0)-(63,4))
│ └── numeric:
- │ @ IntegerNode (location: (59,0)-(59,3))
+ │ @ IntegerNode (location: (63,0)-(63,3))
│ └── flags: decimal
- ├── @ ImaginaryNode (location: (61,0)-(61,4))
+ ├── @ ImaginaryNode (location: (65,0)-(65,4))
│ └── numeric:
- │ @ IntegerNode (location: (61,0)-(61,3))
+ │ @ IntegerNode (location: (65,0)-(65,3))
│ └── flags: decimal
- └── @ ImaginaryNode (location: (63,0)-(63,5))
+ └── @ ImaginaryNode (location: (67,0)-(67,5))
└── numeric:
- @ RationalNode (location: (63,0)-(63,4))
+ @ RationalNode (location: (67,0)-(67,4))
└── numeric:
- @ IntegerNode (location: (63,0)-(63,3))
+ @ IntegerNode (location: (67,0)-(67,3))
└── flags: binary