|
6 | 6 | context "for a root node representing an #{connector} connection" do |
7 | 7 | it 'returns a Hash with key :or and the connected children' do |
8 | 8 | input = "1.to_s #{connector} 5.5" |
9 | | - output = { or: [[fixnum_or_integer, :to_s], Float] } |
| 9 | + output = { or: [[Integer, :to_s], Float] } |
10 | 10 | expect(input).to be_parsed_as output |
11 | 11 | end |
12 | 12 | end |
|
16 | 16 | context "for a root node representing an #{connector} connection" do |
17 | 17 | it 'returns a Hash with key :and and the connected children' do |
18 | 18 | input = "1.to_s #{connector} 5.5" |
19 | | - output = { and: [[fixnum_or_integer, :to_s], Float] } |
| 19 | + output = { and: [[Integer, :to_s], Float] } |
20 | 20 | expect(input).to be_parsed_as output |
21 | 21 | end |
22 | 22 | end |
|
26 | 26 | context 'with only an if clause' do |
27 | 27 | it 'returns a Hash with key :if and the if clause body' do |
28 | 28 | input = "'2'.to_i if 2 == '2'" |
29 | | - output = { if: [fixnum_or_integer, :==, String], then: [String, :to_i] } |
| 29 | + output = { if: [Integer, :==, String], then: [String, :to_i] } |
30 | 30 | expect(input).to be_parsed_as output |
31 | 31 | end |
32 | 32 | end |
33 | 33 |
|
34 | 34 | context 'with an if/then clause' do |
35 | 35 | it 'returns a Hash with key :if and the if clause body' do |
36 | 36 | input = "if 2 == '2' then '2'.to_i end" |
37 | | - output = { if: [fixnum_or_integer, :==, String], then: [String, :to_i] } |
| 37 | + output = { if: [Integer, :==, String], then: [String, :to_i] } |
38 | 38 | expect(input).to be_parsed_as output |
39 | 39 | end |
40 | 40 | end |
|
43 | 43 | it 'returns a Hash with key :if and the if clause body' do |
44 | 44 | input = "if 2 == '2' then '2'.to_i else Rational(2, 3).to_s end" |
45 | 45 | output = { |
46 | | - if: [fixnum_or_integer, :==, String], |
| 46 | + if: [Integer, :==, String], |
47 | 47 | then: [String, :to_i], |
48 | 48 | else: [Rational, :to_s] |
49 | 49 | } |
|
56 | 56 | it 'returns a Hash with key :if and the if clause body' do |
57 | 57 | input = "if 2 == '2' then '2'.to_i elsif true then Object.new end" |
58 | 58 | output = { |
59 | | - if: [fixnum_or_integer, :==, String], |
| 59 | + if: [Integer, :==, String], |
60 | 60 | then: [String, :to_i], |
61 | 61 | else: { |
62 | 62 | if: TrueClass, |
|
124 | 124 | module: [ |
125 | 125 | { const: :Breakable }, |
126 | 126 | [ |
127 | | - { casgn: [:CONST, fixnum_or_integer] }, |
| 127 | + { casgn: [:CONST, Integer] }, |
128 | 128 | { casgn: [:OTHER_CONST, [String, :freeze]] } |
129 | 129 | ] |
130 | 130 | ] |
|
138 | 138 | context 'for a root node representing a return' do |
139 | 139 | it 'returns a Hash with key :return and the returned value' do |
140 | 140 | input = 'return 3' |
141 | | - output = { return: fixnum_or_integer } |
| 141 | + output = { return: Integer } |
142 | 142 | expect(input).to be_parsed_as output |
143 | 143 | end |
144 | 144 |
|
145 | 145 | it 'returns a Hash with key :return and the returned values as Array' do |
146 | 146 | input = 'return 3 + 2' |
147 | | - output = { return: [fixnum_or_integer, :+, fixnum_or_integer] } |
| 147 | + output = { return: [Integer, :+, Integer] } |
148 | 148 | expect(input).to be_parsed_as output |
149 | 149 | end |
150 | 150 | end |
151 | 151 |
|
152 | 152 | context 'for a root node representing a yield' do |
153 | 153 | it 'returns a Hash with key :yield and the types of given arguments' do |
154 | 154 | input = "yield(3, 'beer')" |
155 | | - output = { yield: [fixnum_or_integer, String] } |
| 155 | + output = { yield: [Integer, String] } |
156 | 156 | expect(input).to be_parsed_as output |
157 | 157 | end |
158 | 158 |
|
|
184 | 184 | input = "for i in 1..5 do\nputs i\nend" |
185 | 185 | output = { |
186 | 186 | for: { lvasgn: [:i] }, |
187 | | - in: { irange: [fixnum_or_integer, fixnum_or_integer] }, |
| 187 | + in: { irange: [Integer, Integer] }, |
188 | 188 | do: [:puts, { lvar: :i }] |
189 | 189 | } |
190 | 190 |
|
|
247 | 247 | { |
248 | 248 | case: [ |
249 | 249 | { lvar: :state }, |
250 | | - { when: Symbol, then: [fixnum_or_integer, :to_s] }, |
251 | | - { when: Symbol, then: [fixnum_or_integer, :to_s] }, |
252 | | - { else: fixnum_or_integer } |
| 250 | + { when: Symbol, then: [Integer, :to_s] }, |
| 251 | + { when: Symbol, then: [Integer, :to_s] }, |
| 252 | + { else: Integer } |
253 | 253 | ] |
254 | 254 | } |
255 | 255 | ] |
|
266 | 266 | { |
267 | 267 | case: [ |
268 | 268 | { lvar: :state }, |
269 | | - { when: Symbol, then: [fixnum_or_integer, :to_s] }, |
270 | | - { when: Symbol, then: [fixnum_or_integer, :to_s] }, |
| 269 | + { when: Symbol, then: [Integer, :to_s] }, |
| 270 | + { when: Symbol, then: [Integer, :to_s] }, |
271 | 271 | { else: NilClass } |
272 | 272 | ] |
273 | 273 | } |
|
0 commit comments