ripper_ruby_parser 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +4 -23
  4. data/Rakefile +12 -12
  5. data/lib/ripper_ruby_parser.rb +2 -2
  6. data/lib/ripper_ruby_parser/commenting_ripper_parser.rb +9 -9
  7. data/lib/ripper_ruby_parser/parser.rb +3 -3
  8. data/lib/ripper_ruby_parser/sexp_handlers.rb +9 -9
  9. data/lib/ripper_ruby_parser/sexp_handlers/assignment.rb +3 -9
  10. data/lib/ripper_ruby_parser/sexp_handlers/blocks.rb +19 -24
  11. data/lib/ripper_ruby_parser/sexp_handlers/literals.rb +14 -18
  12. data/lib/ripper_ruby_parser/sexp_handlers/methods.rb +3 -3
  13. data/lib/ripper_ruby_parser/sexp_processor.rb +4 -4
  14. data/lib/ripper_ruby_parser/unescape.rb +11 -11
  15. data/lib/ripper_ruby_parser/version.rb +1 -1
  16. data/test/end_to_end/comments_test.rb +10 -10
  17. data/test/end_to_end/comparison_test.rb +28 -28
  18. data/test/end_to_end/lib_comparison_test.rb +6 -6
  19. data/test/end_to_end/line_numbering_test.rb +10 -10
  20. data/test/end_to_end/samples_comparison_test.rb +5 -5
  21. data/test/end_to_end/test_comparison_test.rb +6 -6
  22. data/test/pt_testcase/pt_test.rb +7 -7
  23. data/test/ripper_ruby_parser/commenting_ripper_parser_test.rb +163 -169
  24. data/test/ripper_ruby_parser/parser_test.rb +338 -338
  25. data/test/ripper_ruby_parser/sexp_handlers/assignment_test.rb +475 -511
  26. data/test/ripper_ruby_parser/sexp_handlers/blocks_test.rb +582 -564
  27. data/test/ripper_ruby_parser/sexp_handlers/conditionals_test.rb +469 -469
  28. data/test/ripper_ruby_parser/sexp_handlers/literals_test.rb +713 -724
  29. data/test/ripper_ruby_parser/sexp_handlers/loops_test.rb +155 -155
  30. data/test/ripper_ruby_parser/sexp_handlers/method_calls_test.rb +181 -181
  31. data/test/ripper_ruby_parser/sexp_handlers/methods_test.rb +337 -352
  32. data/test/ripper_ruby_parser/sexp_handlers/operators_test.rb +298 -298
  33. data/test/ripper_ruby_parser/sexp_processor_test.rb +119 -119
  34. data/test/ripper_ruby_parser/version_test.rb +2 -2
  35. data/test/samples/lambdas.rb +5 -0
  36. data/test/samples/misc.rb +3 -0
  37. data/test/samples/strings.rb +7 -0
  38. data/test/test_helper.rb +8 -6
  39. metadata +12 -10
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
3
+ require File.expand_path("../test_helper.rb", File.dirname(__FILE__))
4
4
 
5
5
  class TestProcessor < RipperRubyParser::SexpProcessor
6
6
  def process_foo(exp)
@@ -24,280 +24,280 @@ describe RipperRubyParser::SexpProcessor do
24
24
  TestProcessor.new
25
25
  end
26
26
 
27
- describe '#process' do
28
- describe 'for a :program sexp' do
29
- it 'strips off the outer :program node' do
27
+ describe "#process" do
28
+ describe "for a :program sexp" do
29
+ it "strips off the outer :program node" do
30
30
  sexp = s(:program, s(:stmts, s(:foo)))
31
31
  result = processor.process sexp
32
- result.must_equal s(:foo_p)
32
+ _(result).must_equal s(:foo_p)
33
33
  end
34
34
 
35
- it 'transforms a multi-statement :program into a :block sexp' do
35
+ it "transforms a multi-statement :program into a :block sexp" do
36
36
  sexp = s(:program, s(:stmts, s(:foo), s(:bar)))
37
37
  result = processor.process sexp
38
- result.must_equal s(:block, s(:foo_p), s(:bar_p))
38
+ _(result).must_equal s(:block, s(:foo_p), s(:bar_p))
39
39
  end
40
40
  end
41
41
 
42
- describe 'for a :string_literal sexp' do
43
- it 'transforms a simple sexp to :str' do
42
+ describe "for a :string_literal sexp" do
43
+ it "transforms a simple sexp to :str" do
44
44
  sexp = s(:string_literal,
45
45
  s(:string_content,
46
- s(:@tstring_content, 'foo', s(1, 1), '"')))
46
+ s(:@tstring_content, "foo", s(1, 1), '"')))
47
47
  result = processor.process sexp
48
- result.must_equal s(:str, 'foo')
48
+ _(result).must_equal s(:str, "foo")
49
49
  end
50
50
  end
51
51
 
52
- describe 'for a :command sexp' do
53
- it 'transforms a sexp to a :call' do
54
- sexp = s(:command, s(:@ident, 'foo', s(1, 0)), s(:arglist, s(:foo)))
52
+ describe "for a :command sexp" do
53
+ it "transforms a sexp to a :call" do
54
+ sexp = s(:command, s(:@ident, "foo", s(1, 0)), s(:arglist, s(:foo)))
55
55
  result = processor.process sexp
56
- result.must_equal s(:call, nil, :foo, s(:foo_p))
56
+ _(result).must_equal s(:call, nil, :foo, s(:foo_p))
57
57
  end
58
58
  end
59
59
 
60
- describe 'for a :var_ref sexp' do
61
- it 'transforms the sexp to a :lvar sexp' do
62
- sexp = s(:var_ref, s(:@ident, 'bar', s(1, 4)))
60
+ describe "for a :var_ref sexp" do
61
+ it "transforms the sexp to a :lvar sexp" do
62
+ sexp = s(:var_ref, s(:@ident, "bar", s(1, 4)))
63
63
  result = processor.process sexp
64
- result.must_equal s(:lvar, :bar)
64
+ _(result).must_equal s(:lvar, :bar)
65
65
  end
66
66
  end
67
67
 
68
- describe 'for a :vcall sexp' do
69
- it 'transforms the sexp to a :call sexp' do
70
- sexp = s(:vcall, s(:@ident, 'bar', s(1, 4)))
68
+ describe "for a :vcall sexp" do
69
+ it "transforms the sexp to a :call sexp" do
70
+ sexp = s(:vcall, s(:@ident, "bar", s(1, 4)))
71
71
  result = processor.process sexp
72
- result.must_equal s(:call, nil, :bar)
72
+ _(result).must_equal s(:call, nil, :bar)
73
73
  end
74
74
  end
75
75
 
76
- describe 'for a :module sexp' do
77
- it 'does not create body elements for an empty definition' do
76
+ describe "for a :module sexp" do
77
+ it "does not create body elements for an empty definition" do
78
78
  sexp = s(:module,
79
- s(:const_ref, s(:@const, 'Foo', s(1, 13))),
79
+ s(:const_ref, s(:@const, "Foo", s(1, 13))),
80
80
  s(:bodystmt, s(:stmts, s(:void_stmt, s(2, 3))), nil, nil, nil))
81
81
  result = processor.process sexp
82
- result.must_equal s(:module, :Foo)
82
+ _(result).must_equal s(:module, :Foo)
83
83
  end
84
84
 
85
- it 'creates a single body element for a definition with one statement' do
85
+ it "creates a single body element for a definition with one statement" do
86
86
  sexp = s(:module,
87
- s(:const_ref, s(:@const, 'Foo', s(1, 13))),
87
+ s(:const_ref, s(:@const, "Foo", s(1, 13))),
88
88
  s(:bodystmt, s(:stmts, s(:foo)), nil, nil, nil))
89
89
  result = processor.process sexp
90
- result.must_equal s(:module, :Foo, s(:foo_p))
90
+ _(result).must_equal s(:module, :Foo, s(:foo_p))
91
91
  end
92
92
 
93
- it 'creates multiple body elements for a definition with more than one statement' do
93
+ it "creates multiple body elements for a definition with more than one statement" do
94
94
  sexp = s(:module,
95
- s(:const_ref, s(:@const, 'Foo', s(1, 13))),
95
+ s(:const_ref, s(:@const, "Foo", s(1, 13))),
96
96
  s(:bodystmt, s(:stmts, s(:foo), s(:bar)), nil, nil, nil))
97
97
  result = processor.process sexp
98
- result.must_equal s(:module, :Foo, s(:foo_p), s(:bar_p))
98
+ _(result).must_equal s(:module, :Foo, s(:foo_p), s(:bar_p))
99
99
  end
100
100
  end
101
101
 
102
- describe 'for a :class sexp' do
103
- it 'does not create body eleents for an empty definition' do
102
+ describe "for a :class sexp" do
103
+ it "does not create body eleents for an empty definition" do
104
104
  sexp = s(:class,
105
- s(:const_ref, s(:@const, 'Foo', s(1, 13))), nil,
105
+ s(:const_ref, s(:@const, "Foo", s(1, 13))), nil,
106
106
  s(:bodystmt, s(:stmts, s(:void_stmt, s(2, 8))), nil, nil, nil))
107
107
  result = processor.process sexp
108
- result.must_equal s(:class, :Foo, nil)
108
+ _(result).must_equal s(:class, :Foo, nil)
109
109
  end
110
110
 
111
- it 'creates a single body element for a definition with one statement' do
111
+ it "creates a single body element for a definition with one statement" do
112
112
  sexp = s(:class,
113
- s(:const_ref, s(:@const, 'Foo', s(1, 13))), nil,
113
+ s(:const_ref, s(:@const, "Foo", s(1, 13))), nil,
114
114
  s(:bodystmt, s(:stmts, s(:foo)), nil, nil, nil))
115
115
  result = processor.process sexp
116
- result.must_equal s(:class, :Foo, nil, s(:foo_p))
116
+ _(result).must_equal s(:class, :Foo, nil, s(:foo_p))
117
117
  end
118
118
 
119
- it 'creates multiple body elements for a definition with more than one statement' do
119
+ it "creates multiple body elements for a definition with more than one statement" do
120
120
  sexp = s(:class,
121
- s(:const_ref, s(:@const, 'Foo', s(1, 13))), nil,
121
+ s(:const_ref, s(:@const, "Foo", s(1, 13))), nil,
122
122
  s(:bodystmt, s(:stmts, s(:foo), s(:bar)), nil, nil, nil))
123
123
  result = processor.process sexp
124
- result.must_equal s(:class, :Foo, nil, s(:foo_p), s(:bar_p))
124
+ _(result).must_equal s(:class, :Foo, nil, s(:foo_p), s(:bar_p))
125
125
  end
126
126
 
127
- it 'passes on the given ancestor' do
127
+ it "passes on the given ancestor" do
128
128
  sexp = s(:class,
129
- s(:const_ref, s(:@const, 'Foo', s(1, 13))),
130
- s(:var_ref, s(:@const, 'Bar', s(1, 12))),
129
+ s(:const_ref, s(:@const, "Foo", s(1, 13))),
130
+ s(:var_ref, s(:@const, "Bar", s(1, 12))),
131
131
  s(:bodystmt, s(:stmts, s(:void_stmt, s(2, 7))), nil, nil, nil))
132
132
  result = processor.process sexp
133
- result.must_equal s(:class, :Foo, s(:const, :Bar))
133
+ _(result).must_equal s(:class, :Foo, s(:const, :Bar))
134
134
  end
135
135
  end
136
136
 
137
- describe 'for a :bodystmt sexp' do
138
- it 'creates a :block sexp when multiple statements are present' do
137
+ describe "for a :bodystmt sexp" do
138
+ it "creates a :block sexp when multiple statements are present" do
139
139
  sexp = s(:bodystmt, s(:stmts, s(:foo), s(:bar)), nil, nil, nil)
140
140
  result = processor.process sexp
141
- result.must_equal s(:block, s(:foo_p), s(:bar_p))
141
+ _(result).must_equal s(:block, s(:foo_p), s(:bar_p))
142
142
  end
143
143
 
144
- it 'removes nested :void_stmt sexps' do
144
+ it "removes nested :void_stmt sexps" do
145
145
  sexp = s(:bodystmt, s(:stmts, s(:void_stmt), s(:foo)), nil, nil, nil)
146
146
  result = processor.process sexp
147
- result.must_equal s(:foo_p)
147
+ _(result).must_equal s(:foo_p)
148
148
  end
149
149
  end
150
150
 
151
- describe 'for a :def sexp' do
152
- it 'transforms the sexp for a basic function definition' do
151
+ describe "for a :def sexp" do
152
+ it "transforms the sexp for a basic function definition" do
153
153
  sexp = s(:def,
154
- s(:@ident, 'foo', s(1, 4)),
154
+ s(:@ident, "foo", s(1, 4)),
155
155
  s(:params, nil, nil, nil, nil, nil),
156
156
  s(:bodystmt, s(:stmts, s(:void_stmt, s(2, 3))), nil, nil, nil))
157
157
  result = processor.process sexp
158
- result.must_equal s(:defn, :foo, s(:args), s(:nil))
158
+ _(result).must_equal s(:defn, :foo, s(:args), s(:nil))
159
159
  end
160
160
  end
161
161
 
162
- describe 'for a :params sexp' do
163
- describe 'with a normal arguments' do
164
- it 'creates :lvar sexps' do
165
- sexp = s(:params, s(s(:@ident, 'bar', s(1, 8))), nil, nil, nil, nil)
162
+ describe "for a :params sexp" do
163
+ describe "with a normal arguments" do
164
+ it "creates :lvar sexps" do
165
+ sexp = s(:params, s(s(:@ident, "bar", s(1, 8))), nil, nil, nil, nil)
166
166
  result = processor.process sexp
167
- result.must_equal s(:args, s(:lvar, :bar))
167
+ _(result).must_equal s(:args, s(:lvar, :bar))
168
168
  end
169
169
  end
170
170
 
171
- describe 'with a ruby 2.4-style doublesplat argument' do
172
- it 'creates :lvar sexps' do
171
+ describe "with a ruby 2.4-style doublesplat argument" do
172
+ it "creates :lvar sexps" do
173
173
  sexp = s(:params,
174
174
  nil, nil, nil, nil, nil,
175
- s(:@ident, 'bar', s(1, 8)),
175
+ s(:@ident, "bar", s(1, 8)),
176
176
  nil)
177
177
  result = processor.process sexp
178
- result.must_equal s(:args, s(:dsplat, s(:lvar, :bar)))
178
+ _(result).must_equal s(:args, s(:dsplat, s(:lvar, :bar)))
179
179
  end
180
180
  end
181
- describe 'with a ruby 2.5-style kwrest argument' do
182
- it 'creates :lvar sexps' do
181
+ describe "with a ruby 2.5-style kwrest argument" do
182
+ it "creates :lvar sexps" do
183
183
  sexp = s(:params,
184
184
  nil, nil, nil, nil, nil,
185
- s(:kwrest_param, s(:@ident, 'bar', s(1, 8))),
185
+ s(:kwrest_param, s(:@ident, "bar", s(1, 8))),
186
186
  nil)
187
187
  result = processor.process sexp
188
- result.must_equal s(:args, s(:dsplat, s(:lvar, :bar)))
188
+ _(result).must_equal s(:args, s(:dsplat, s(:lvar, :bar)))
189
189
  end
190
190
  end
191
191
  end
192
192
 
193
- describe 'for an :assign sexp' do
194
- it 'creates a :lasgn sexp' do
193
+ describe "for an :assign sexp" do
194
+ it "creates a :lasgn sexp" do
195
195
  sexp = s(:assign,
196
- s(:var_field, s(:@ident, 'a', s(1, 0))),
197
- s(:@int, '1', s(1, 4)))
196
+ s(:var_field, s(:@ident, "a", s(1, 0))),
197
+ s(:@int, "1", s(1, 4)))
198
198
  result = processor.process sexp
199
- result.must_equal s(:lasgn, :a, s(:lit, 1))
199
+ _(result).must_equal s(:lasgn, :a, s(:lit, 1))
200
200
  end
201
201
  end
202
202
 
203
- describe 'for a :binary sexp' do
204
- it 'creates a :call sexp' do
203
+ describe "for a :binary sexp" do
204
+ it "creates a :call sexp" do
205
205
  sexp = s(:binary, s(:bar), :==, s(:foo))
206
206
  result = processor.process sexp
207
- result.must_equal s(:call, s(:bar_p), :==, s(:foo_p))
207
+ _(result).must_equal s(:call, s(:bar_p), :==, s(:foo_p))
208
208
  end
209
209
  end
210
210
 
211
- describe 'for a :method_add_block sexp' do
212
- it 'creates an :iter sexp' do
211
+ describe "for a :method_add_block sexp" do
212
+ it "creates an :iter sexp" do
213
213
  sexp = s(:method_add_block,
214
- s(:call, s(:foo), :".", s(:@ident, 'baz', s(1, 2))),
214
+ s(:call, s(:foo), :".", s(:@ident, "baz", s(1, 2))),
215
215
  s(:brace_block, nil, s(:stmts, s(:bar))))
216
216
  result = processor.process sexp
217
- result.must_equal s(:iter,
218
- s(:call, s(:foo_p), :baz), 0,
219
- s(:bar_p))
217
+ _(result).must_equal s(:iter,
218
+ s(:call, s(:foo_p), :baz), 0,
219
+ s(:bar_p))
220
220
  end
221
221
 
222
- describe 'with a block parameter' do
223
- it 'creates an :iter sexp with an :args sexp for the block parameter' do
222
+ describe "with a block parameter" do
223
+ it "creates an :iter sexp with an :args sexp for the block parameter" do
224
224
  sexp = s(:method_add_block,
225
- s(:call, s(:foo), :".", s(:@ident, 'baz', s(1, 2))),
225
+ s(:call, s(:foo), :".", s(:@ident, "baz", s(1, 2))),
226
226
  s(:brace_block,
227
227
  s(:block_var,
228
- s(:params, s(s(:@ident, 'i', s(1, 6))), nil, nil, nil, nil),
228
+ s(:params, s(s(:@ident, "i", s(1, 6))), nil, nil, nil, nil),
229
229
  nil),
230
230
  s(:stmts, s(:bar))))
231
231
  result = processor.process sexp
232
- result.must_equal s(:iter,
233
- s(:call, s(:foo_p), :baz),
234
- s(:args, :i),
235
- s(:bar_p))
232
+ _(result).must_equal s(:iter,
233
+ s(:call, s(:foo_p), :baz),
234
+ s(:args, :i),
235
+ s(:bar_p))
236
236
  end
237
237
  end
238
238
  end
239
239
 
240
- describe 'for an :if sexp' do
241
- describe 'with a single statement in the if body' do
242
- it 'uses the statement sexp as the body' do
240
+ describe "for an :if sexp" do
241
+ describe "with a single statement in the if body" do
242
+ it "uses the statement sexp as the body" do
243
243
  sexp = s(:if, s(:foo), s(:stmts, s(:bar)), nil)
244
244
  result = processor.process sexp
245
- result.must_equal s(:if, s(:foo_p), s(:bar_p), nil)
245
+ _(result).must_equal s(:if, s(:foo_p), s(:bar_p), nil)
246
246
  end
247
247
  end
248
248
 
249
- describe 'with multiple statements in the if body' do
250
- it 'uses a block containing the statement sexps as the body' do
249
+ describe "with multiple statements in the if body" do
250
+ it "uses a block containing the statement sexps as the body" do
251
251
  sexp = s(:if, s(:foo), s(:stmts, s(:bar), s(:baz)), nil)
252
252
  result = processor.process sexp
253
- result.must_equal s(:if, s(:foo_p), s(:block, s(:bar_p), s(:baz_p)), nil)
253
+ _(result).must_equal s(:if, s(:foo_p), s(:block, s(:bar_p), s(:baz_p)), nil)
254
254
  end
255
255
  end
256
256
  end
257
257
 
258
- describe 'for an :array sexp' do
259
- it 'pulls up the element sexps' do
258
+ describe "for an :array sexp" do
259
+ it "pulls up the element sexps" do
260
260
  sexp = s(:array, s(:words, s(:foo), s(:bar), s(:baz)))
261
261
  result = processor.process sexp
262
- result.must_equal s(:array, s(:foo_p), s(:bar_p), s(:baz_p))
262
+ _(result).must_equal s(:array, s(:foo_p), s(:bar_p), s(:baz_p))
263
263
  end
264
264
  end
265
265
 
266
- describe 'for a :const_path_ref sexp' do
267
- it 'returns a :colon2 sexp' do
266
+ describe "for a :const_path_ref sexp" do
267
+ it "returns a :colon2 sexp" do
268
268
  sexp = s(:const_path_ref,
269
- s(:var_ref, s(:@const, 'Foo', s(1, 0))),
270
- s(:@const, 'Bar', s(1, 5)))
269
+ s(:var_ref, s(:@const, "Foo", s(1, 0))),
270
+ s(:@const, "Bar", s(1, 5)))
271
271
  result = processor.process sexp
272
- result.must_equal s(:colon2, s(:const, :Foo), :Bar)
272
+ _(result).must_equal s(:colon2, s(:const, :Foo), :Bar)
273
273
  end
274
274
  end
275
275
 
276
- describe 'for a :when sexp' do
277
- it 'turns nested :when clauses into a list' do
276
+ describe "for a :when sexp" do
277
+ it "turns nested :when clauses into a list" do
278
278
  sexp = s(:when, s(:args, s(:foo)), s(:stmts, s(:bar)),
279
279
  s(:when, s(:args, s(:foo)), s(:stmts, s(:bar)),
280
280
  s(:when, s(:args, s(:foo)), s(:stmts, s(:bar)), nil)))
281
281
  result = processor.process sexp
282
- result.must_equal s(s(:when, s(:array, s(:foo_p)), s(:bar_p)),
283
- s(:when, s(:array, s(:foo_p)), s(:bar_p)),
284
- s(:when, s(:array, s(:foo_p)), s(:bar_p)),
285
- nil)
282
+ _(result).must_equal s(s(:when, s(:array, s(:foo_p)), s(:bar_p)),
283
+ s(:when, s(:array, s(:foo_p)), s(:bar_p)),
284
+ s(:when, s(:array, s(:foo_p)), s(:bar_p)),
285
+ nil)
286
286
  end
287
287
  end
288
288
  end
289
289
 
290
- describe '#extract_node_symbol' do
291
- it 'processes an lvar sexp to a bare symbol' do
292
- sexp = s(:lvar, 'foo')
290
+ describe "#extract_node_symbol" do
291
+ it "processes an lvar sexp to a bare symbol" do
292
+ sexp = s(:lvar, "foo")
293
293
  result = processor.send :extract_node_symbol, sexp
294
- result.must_equal :foo
294
+ _(result).must_equal :foo
295
295
  end
296
296
 
297
- it 'processes a const sexp to a bare symbol' do
298
- sexp = s(:const, 'Foo')
297
+ it "processes a const sexp to a bare symbol" do
298
+ sexp = s(:const, "Foo")
299
299
  result = processor.send :extract_node_symbol, sexp
300
- result.must_equal :Foo
300
+ _(result).must_equal :Foo
301
301
  end
302
302
  end
303
303
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe RipperRubyParser do
4
- it 'knows its own version' do
5
- RipperRubyParser::VERSION.wont_be_nil
4
+ it "knows its own version" do
5
+ _(RipperRubyParser::VERSION).wont_be_nil
6
6
  end
7
7
  end
@@ -0,0 +1,5 @@
1
+ -> { }
2
+ ->() { }
3
+ ->(foo) { foo + bar }
4
+ lambda { }
5
+ lambda { |foo| foo + bar }
@@ -276,3 +276,6 @@ end
276
276
 
277
277
  # Special symbols
278
278
  [:`, :|, :*, :&, :%, :'^', :-@, :+@, :'~@']
279
+
280
+ # Blocks
281
+ foo do |bar, | end
@@ -49,6 +49,13 @@ FOO
49
49
  foo\rbar\tbaz\r
50
50
  FOO
51
51
 
52
+ # Dedented heredocs
53
+ foo = <<~BAR
54
+ baz
55
+ #{qux}
56
+ quuz
57
+ BAR
58
+
52
59
  # Line continuation
53
60
  "foo\
54
61
  bar"
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'simplecov'
3
+ require "simplecov"
4
4
  SimpleCov.start do
5
- add_filter '/test/'
5
+ add_filter "/test/"
6
6
  end
7
7
 
8
- require 'minitest/autorun'
8
+ require "minitest/autorun"
9
9
 
10
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
10
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
11
11
 
12
- require 'ripper_ruby_parser'
12
+ require "ripper_ruby_parser"
13
13
 
14
14
  module MiniTest
15
15
  class Spec
@@ -40,7 +40,9 @@ module MiniTest
40
40
  end
41
41
 
42
42
  def fix_lines(exp)
43
- return s(:lit, :__LINE__).line(exp.line) if exp.sexp_type == :lit && exp.line == exp[1]
43
+ if exp.sexp_type == :lit && exp.line == exp[1]
44
+ return s(:lit, :__LINE__).line(exp.line)
45
+ end
44
46
 
45
47
  exp.sexp_body = exp.sexp_body.map do |sub_exp|
46
48
  if sub_exp.is_a? Sexp