synvert-core 1.2.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,11 @@ module Synvert::Core
6
6
  # Initialize a RemoveAction.
7
7
  #
8
8
  # @param instance [Synvert::Core::Rewriter::RemoveAction]
9
- def initialize(instance)
9
+ # @param options [Hash] options.
10
+ # @option and_comma [Boolean] delete extra comma.
11
+ def initialize(instance, and_comma: false)
10
12
  super(instance, nil)
13
+ @and_comma = and_comma
11
14
  end
12
15
 
13
16
  # The rewritten code, always empty string.
@@ -27,7 +30,7 @@ module Synvert::Core
27
30
  @begin_pos = @node.loc.expression.begin_pos
28
31
  @end_pos = @node.loc.expression.end_pos
29
32
  squeeze_spaces
30
- remove_comma
33
+ remove_comma if @and_command
31
34
  end
32
35
  end
33
36
 
@@ -333,8 +333,10 @@ module Synvert::Core
333
333
  # with_node type: 'send', message: { in: %w[puts p] } do
334
334
  # remove
335
335
  # end
336
- def remove
337
- @actions << Rewriter::RemoveAction.new(self).process
336
+ # @param options [Hash] options.
337
+ # @option and_comma [Boolean] delete extra comma.
338
+ def remove(**options)
339
+ @actions << Rewriter::RemoveAction.new(self, **options).process
338
340
  end
339
341
 
340
342
  # Parse +delete+ dsl, it creates a {Synvert::Core::Rewriter::DeleteAction} to delete child nodes.
@@ -346,8 +348,10 @@ module Synvert::Core
346
348
  # delete :receiver, :dot
347
349
  # end
348
350
  # @param selectors [Array<Symbol>] selector names of child node.
349
- def delete(*selectors)
350
- @actions << Rewriter::DeleteAction.new(self, *selectors).process
351
+ # @param options [Hash]
352
+ # @option and_comma [Boolean] delete extra comma.
353
+ def delete(*selectors, **options)
354
+ @actions << Rewriter::DeleteAction.new(self, *selectors, **options).process
351
355
  end
352
356
 
353
357
  # Parse +wrap+ dsl, it creates a {Synvert::Core::Rewriter::WrapAction} to
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.2.1'
5
+ VERSION = '1.4.0'
6
6
  end
7
7
  end
@@ -29,7 +29,7 @@ module Synvert::Core::NodeQuery
29
29
  [:tNODE_TYPE, "send"],
30
30
  [:tOPEN_ATTRIBUTE, "["],
31
31
  [:tKEY, "message"],
32
- [:tEQUAL, "="],
32
+ [:tOPERATOR, "=="],
33
33
  [:tIDENTIFIER_VALUE, "create"],
34
34
  [:tCLOSE_ATTRIBUTE, "]"]
35
35
  ]
@@ -42,7 +42,7 @@ module Synvert::Core::NodeQuery
42
42
  [:tNODE_TYPE, "send"],
43
43
  [:tOPEN_ATTRIBUTE, "["],
44
44
  [:tKEY, "receiver"],
45
- [:tEQUAL, "="],
45
+ [:tOPERATOR, "=="],
46
46
  [:tNIL, nil],
47
47
  [:tCLOSE_ATTRIBUTE, "]"]
48
48
  ]
@@ -55,7 +55,7 @@ module Synvert::Core::NodeQuery
55
55
  [:tNODE_TYPE, "send"],
56
56
  [:tOPEN_ATTRIBUTE, "["],
57
57
  [:tKEY, "message"],
58
- [:tEQUAL, "="],
58
+ [:tOPERATOR, "=="],
59
59
  [:tSTRING, "create"],
60
60
  [:tCLOSE_ATTRIBUTE, "]"]
61
61
  ]
@@ -68,7 +68,7 @@ module Synvert::Core::NodeQuery
68
68
  [:tNODE_TYPE, "send"],
69
69
  [:tOPEN_ATTRIBUTE, "["],
70
70
  [:tKEY, "message"],
71
- [:tEQUAL, "="],
71
+ [:tOPERATOR, "=="],
72
72
  [:tSTRING, "[]"],
73
73
  [:tCLOSE_ATTRIBUTE, "]"]
74
74
  ]
@@ -81,7 +81,7 @@ module Synvert::Core::NodeQuery
81
81
  [:tNODE_TYPE, "send"],
82
82
  [:tOPEN_ATTRIBUTE, "["],
83
83
  [:tKEY, "message"],
84
- [:tEQUAL, "="],
84
+ [:tOPERATOR, "=="],
85
85
  [:tSYMBOL, :create],
86
86
  [:tCLOSE_ATTRIBUTE, "]"]
87
87
  ]
@@ -93,7 +93,7 @@ module Synvert::Core::NodeQuery
93
93
  expected_tokens = [
94
94
  [:tOPEN_ATTRIBUTE, "["],
95
95
  [:tKEY, "value"],
96
- [:tEQUAL, "="],
96
+ [:tOPERATOR, "=="],
97
97
  [:tINTEGER, 1],
98
98
  [:tCLOSE_ATTRIBUTE, "]"]
99
99
  ]
@@ -106,7 +106,7 @@ module Synvert::Core::NodeQuery
106
106
  [:tNODE_TYPE, "send"],
107
107
  [:tOPEN_ATTRIBUTE, "["],
108
108
  [:tKEY, "value"],
109
- [:tEQUAL, "="],
109
+ [:tOPERATOR, "=="],
110
110
  [:tFLOAT, 1.1],
111
111
  [:tCLOSE_ATTRIBUTE, "]"]
112
112
  ]
@@ -119,7 +119,7 @@ module Synvert::Core::NodeQuery
119
119
  [:tNODE_TYPE, "send"],
120
120
  [:tOPEN_ATTRIBUTE, "["],
121
121
  [:tKEY, "value"],
122
- [:tEQUAL, "="],
122
+ [:tOPERATOR, "=="],
123
123
  [:tBOOLEAN, true],
124
124
  [:tCLOSE_ATTRIBUTE, "]"]
125
125
  ]
@@ -132,7 +132,7 @@ module Synvert::Core::NodeQuery
132
132
  [:tNODE_TYPE, "send"],
133
133
  [:tOPEN_ATTRIBUTE, "["],
134
134
  [:tKEY, "message"],
135
- [:tEQUAL, "="],
135
+ [:tOPERATOR, "=="],
136
136
  [:tIDENTIFIER_VALUE, "create!"],
137
137
  [:tCLOSE_ATTRIBUTE, "]"]
138
138
  ]
@@ -145,7 +145,7 @@ module Synvert::Core::NodeQuery
145
145
  [:tNODE_TYPE, "send"],
146
146
  [:tOPEN_ATTRIBUTE, "["],
147
147
  [:tKEY, "message"],
148
- [:tEQUAL, "="],
148
+ [:tOPERATOR, "=="],
149
149
  [:tIDENTIFIER_VALUE, "empty?"],
150
150
  [:tCLOSE_ATTRIBUTE, "]"]
151
151
  ]
@@ -158,7 +158,7 @@ module Synvert::Core::NodeQuery
158
158
  [:tNODE_TYPE, "send"],
159
159
  [:tOPEN_ATTRIBUTE, "["],
160
160
  [:tKEY, "message"],
161
- [:tEQUAL, "="],
161
+ [:tOPERATOR, "=="],
162
162
  [:tIDENTIFIER_VALUE, "<"],
163
163
  [:tCLOSE_ATTRIBUTE, "]"]
164
164
  ]
@@ -169,7 +169,7 @@ module Synvert::Core::NodeQuery
169
169
  [:tNODE_TYPE, "send"],
170
170
  [:tOPEN_ATTRIBUTE, "["],
171
171
  [:tKEY, "message"],
172
- [:tEQUAL, "="],
172
+ [:tOPERATOR, "=="],
173
173
  [:tIDENTIFIER_VALUE, "="],
174
174
  [:tCLOSE_ATTRIBUTE, "]"]
175
175
  ]
@@ -180,7 +180,7 @@ module Synvert::Core::NodeQuery
180
180
  [:tNODE_TYPE, "send"],
181
181
  [:tOPEN_ATTRIBUTE, "["],
182
182
  [:tKEY, "message"],
183
- [:tEQUAL, "="],
183
+ [:tOPERATOR, "=="],
184
184
  [:tIDENTIFIER_VALUE, ">"],
185
185
  [:tCLOSE_ATTRIBUTE, "]"]
186
186
  ]
@@ -193,7 +193,7 @@ module Synvert::Core::NodeQuery
193
193
  [:tNODE_TYPE, "send"],
194
194
  [:tOPEN_ATTRIBUTE, "["],
195
195
  [:tKEY, "arguments.first"],
196
- [:tEQUAL, "="],
196
+ [:tOPERATOR, "=="],
197
197
  [:tSTRING, ""],
198
198
  [:tCLOSE_ATTRIBUTE, "]"]
199
199
  ]
@@ -206,7 +206,7 @@ module Synvert::Core::NodeQuery
206
206
  [:tNODE_TYPE, "send"],
207
207
  [:tOPEN_ATTRIBUTE, "["],
208
208
  [:tKEY, "message"],
209
- [:tEQUAL, "="],
209
+ [:tOPERATOR, "=="],
210
210
  [:tIDENTIFIER_VALUE, "[]"],
211
211
  [:tCLOSE_ATTRIBUTE, "]"]
212
212
  ]
@@ -219,7 +219,7 @@ module Synvert::Core::NodeQuery
219
219
  [:tNODE_TYPE, "send"],
220
220
  [:tOPEN_ATTRIBUTE, "["],
221
221
  [:tKEY, "message"],
222
- [:tEQUAL, "="],
222
+ [:tOPERATOR, "=="],
223
223
  [:tSYMBOL, :[]=],
224
224
  [:tCLOSE_ATTRIBUTE, "]"]
225
225
  ]
@@ -232,7 +232,7 @@ module Synvert::Core::NodeQuery
232
232
  [:tNODE_TYPE, "send"],
233
233
  [:tOPEN_ATTRIBUTE, "["],
234
234
  [:tKEY, "message"],
235
- [:tEQUAL, "="],
235
+ [:tOPERATOR, "=="],
236
236
  [:tIDENTIFIER_VALUE, "nil?"],
237
237
  [:tCLOSE_ATTRIBUTE, "]"]
238
238
  ]
@@ -245,7 +245,7 @@ module Synvert::Core::NodeQuery
245
245
  [:tNODE_TYPE, "pair"],
246
246
  [:tOPEN_ATTRIBUTE, "["],
247
247
  [:tKEY, "key"],
248
- [:tEQUAL, "="],
248
+ [:tOPERATOR, "=="],
249
249
  [:tOPEN_DYNAMIC_ATTRIBUTE, "{{"],
250
250
  [:tDYNAMIC_ATTRIBUTE, "value"],
251
251
  [:tCLOSE_DYNAMIC_ATTRIBUTE, "}}"],
@@ -265,11 +265,11 @@ module Synvert::Core::NodeQuery
265
265
  [:tNODE_TYPE, "send"],
266
266
  [:tOPEN_ATTRIBUTE, "["],
267
267
  [:tKEY, "receiver"],
268
- [:tEQUAL, "="],
268
+ [:tOPERATOR, "=="],
269
269
  [:tNODE_TYPE, "send"],
270
270
  [:tOPEN_ATTRIBUTE, "["],
271
271
  [:tKEY, "message"],
272
- [:tEQUAL, "="],
272
+ [:tOPERATOR, "=="],
273
273
  [:tSYMBOL, :create],
274
274
  [:tCLOSE_ATTRIBUTE, "]"],
275
275
  [:tCLOSE_ATTRIBUTE, "]"]
@@ -287,20 +287,20 @@ module Synvert::Core::NodeQuery
287
287
  [:tNODE_TYPE, "send"],
288
288
  [:tOPEN_ATTRIBUTE, "["],
289
289
  [:tKEY, "arguments"],
290
- [:tEQUAL, "="],
290
+ [:tOPERATOR, "=="],
291
291
  [:tOPEN_ATTRIBUTE, "["],
292
292
  [:tKEY, "size"],
293
- [:tEQUAL, "="],
293
+ [:tOPERATOR, "=="],
294
294
  [:tINTEGER, 2],
295
295
  [:tCLOSE_ATTRIBUTE, "]"],
296
296
  [:tOPEN_ATTRIBUTE, "["],
297
297
  [:tKEY, "first"],
298
- [:tEQUAL, "="],
298
+ [:tOPERATOR, "=="],
299
299
  [:tNODE_TYPE, "str"],
300
300
  [:tCLOSE_ATTRIBUTE, "]"],
301
301
  [:tOPEN_ATTRIBUTE, "["],
302
302
  [:tKEY, "last"],
303
- [:tEQUAL, "="],
303
+ [:tOPERATOR, "=="],
304
304
  [:tNODE_TYPE, "str"],
305
305
  [:tCLOSE_ATTRIBUTE, "]"],
306
306
  [:tCLOSE_ATTRIBUTE, "]"]
@@ -316,7 +316,7 @@ module Synvert::Core::NodeQuery
316
316
  [:tNODE_TYPE, "send"],
317
317
  [:tOPEN_ATTRIBUTE, "["],
318
318
  [:tKEY, "message"],
319
- [:tNOT_EQUAL, "!="],
319
+ [:tOPERATOR, "!="],
320
320
  [:tIDENTIFIER_VALUE, "create"],
321
321
  [:tCLOSE_ATTRIBUTE, "]"]
322
322
  ]
@@ -328,7 +328,7 @@ module Synvert::Core::NodeQuery
328
328
  expected_tokens = [
329
329
  [:tOPEN_ATTRIBUTE, "["],
330
330
  [:tKEY, "value"],
331
- [:tGREATER_THAN, ">"],
331
+ [:tOPERATOR, ">"],
332
332
  [:tINTEGER, 1],
333
333
  [:tCLOSE_ATTRIBUTE, "]"]
334
334
  ]
@@ -340,7 +340,7 @@ module Synvert::Core::NodeQuery
340
340
  expected_tokens = [
341
341
  [:tOPEN_ATTRIBUTE, "["],
342
342
  [:tKEY, "value"],
343
- [:tLESS_THAN, "<"],
343
+ [:tOPERATOR, "<"],
344
344
  [:tINTEGER, 1],
345
345
  [:tCLOSE_ATTRIBUTE, "]"]
346
346
  ]
@@ -352,7 +352,7 @@ module Synvert::Core::NodeQuery
352
352
  expected_tokens = [
353
353
  [:tOPEN_ATTRIBUTE, "["],
354
354
  [:tKEY, "value"],
355
- [:tGREATER_THAN_OR_EQUAL, ">="],
355
+ [:tOPERATOR, ">="],
356
356
  [:tINTEGER, 1],
357
357
  [:tCLOSE_ATTRIBUTE, "]"]
358
358
  ]
@@ -364,7 +364,7 @@ module Synvert::Core::NodeQuery
364
364
  expected_tokens = [
365
365
  [:tOPEN_ATTRIBUTE, "["],
366
366
  [:tKEY, "value"],
367
- [:tLESS_THAN_OR_EQUAL, "<="],
367
+ [:tOPERATOR, "<="],
368
368
  [:tINTEGER, 1],
369
369
  [:tCLOSE_ATTRIBUTE, "]"]
370
370
  ]
@@ -377,7 +377,7 @@ module Synvert::Core::NodeQuery
377
377
  [:tNODE_TYPE, "send"],
378
378
  [:tOPEN_ATTRIBUTE, "["],
379
379
  [:tKEY, "message"],
380
- [:tMATCH, "=~"],
380
+ [:tOPERATOR, "=~"],
381
381
  [:tREGEXP, /create/i],
382
382
  [:tCLOSE_ATTRIBUTE, "]"]
383
383
  ]
@@ -390,7 +390,7 @@ module Synvert::Core::NodeQuery
390
390
  [:tNODE_TYPE, "send"],
391
391
  [:tOPEN_ATTRIBUTE, "["],
392
392
  [:tKEY, "message"],
393
- [:tNOT_MATCH, "!~"],
393
+ [:tOPERATOR, "!~"],
394
394
  [:tREGEXP, /create/i],
395
395
  [:tCLOSE_ATTRIBUTE, "]"]
396
396
  ]
@@ -403,7 +403,7 @@ module Synvert::Core::NodeQuery
403
403
  [:tNODE_TYPE, "send"],
404
404
  [:tOPEN_ATTRIBUTE, "["],
405
405
  [:tKEY, "arguments"],
406
- [:tEQUAL, "="],
406
+ [:tOPERATOR, "=="],
407
407
  [:tOPEN_ARRAY, "("],
408
408
  [:tCLOSE_ARRAY, ")"],
409
409
  [:tCLOSE_ATTRIBUTE, "]"]
@@ -417,7 +417,7 @@ module Synvert::Core::NodeQuery
417
417
  [:tNODE_TYPE, "send"],
418
418
  [:tOPEN_ATTRIBUTE, "["],
419
419
  [:tKEY, "arguments"],
420
- [:tEQUAL, "="],
420
+ [:tOPERATOR, "=="],
421
421
  [:tOPEN_ARRAY, "("],
422
422
  [:tSYMBOL, :create],
423
423
  [:tCLOSE_ARRAY, ")"],
@@ -432,7 +432,7 @@ module Synvert::Core::NodeQuery
432
432
  [:tNODE_TYPE, "send"],
433
433
  [:tOPEN_ATTRIBUTE, "["],
434
434
  [:tKEY, "arguments"],
435
- [:tNOT_EQUAL, "!="],
435
+ [:tOPERATOR, "!="],
436
436
  [:tOPEN_ARRAY, "("],
437
437
  [:tSYMBOL, :create],
438
438
  [:tCLOSE_ARRAY, ")"],
@@ -447,7 +447,7 @@ module Synvert::Core::NodeQuery
447
447
  [:tNODE_TYPE, "send"],
448
448
  [:tOPEN_ATTRIBUTE, "["],
449
449
  [:tKEY, "message"],
450
- [:tIN, "IN"],
450
+ [:tOPERATOR, "in"],
451
451
  [:tOPEN_ARRAY, "("],
452
452
  [:tIDENTIFIER_VALUE, "create"],
453
453
  [:tIDENTIFIER_VALUE, "build"],
@@ -463,7 +463,7 @@ module Synvert::Core::NodeQuery
463
463
  [:tNODE_TYPE, "send"],
464
464
  [:tOPEN_ATTRIBUTE, "["],
465
465
  [:tKEY, "message"],
466
- [:tNOT_IN, "NOT IN"],
466
+ [:tOPERATOR, "not_in"],
467
467
  [:tOPEN_ARRAY, "("],
468
468
  [:tIDENTIFIER_VALUE, "create"],
469
469
  [:tIDENTIFIER_VALUE, "build"],
@@ -479,7 +479,7 @@ module Synvert::Core::NodeQuery
479
479
  [:tNODE_TYPE, "send"],
480
480
  [:tOPEN_ATTRIBUTE, "["],
481
481
  [:tKEY, "arguments"],
482
- [:tINCLUDES, "INCLUDES"],
482
+ [:tOPERATOR, "includes"],
483
483
  [:tIDENTIFIER_VALUE, "&block"],
484
484
  [:tCLOSE_ATTRIBUTE, "]"]
485
485
  ]
@@ -494,7 +494,7 @@ module Synvert::Core::NodeQuery
494
494
  [:tNODE_TYPE, "send"],
495
495
  [:tOPEN_ATTRIBUTE, "["],
496
496
  [:tKEY, "receiver.message"],
497
- [:tEQUAL, "="],
497
+ [:tOPERATOR, "=="],
498
498
  [:tSYMBOL, :create],
499
499
  [:tCLOSE_ATTRIBUTE, "]"]
500
500
  ]
@@ -502,64 +502,6 @@ module Synvert::Core::NodeQuery
502
502
  end
503
503
  end
504
504
 
505
- context 'position' do
506
- it 'matches :first-child' do
507
- source = '.send[arguments=:create]:first-child'
508
- expected_tokens = [
509
- [:tNODE_TYPE, "send"],
510
- [:tOPEN_ATTRIBUTE, "["],
511
- [:tKEY, "arguments"],
512
- [:tEQUAL, "="],
513
- [:tSYMBOL, :create],
514
- [:tCLOSE_ATTRIBUTE, "]"],
515
- [:tINDEX, 0]
516
- ]
517
- assert_tokens source, expected_tokens
518
- end
519
-
520
- it 'matches :last-child' do
521
- source = '.send[arguments=:create]:last-child'
522
- expected_tokens = [
523
- [:tNODE_TYPE, "send"],
524
- [:tOPEN_ATTRIBUTE, "["],
525
- [:tKEY, "arguments"],
526
- [:tEQUAL, "="],
527
- [:tSYMBOL, :create],
528
- [:tCLOSE_ATTRIBUTE, "]"],
529
- [:tINDEX, -1]
530
- ]
531
- assert_tokens source, expected_tokens
532
- end
533
-
534
- it 'matches :nth-child(1)' do
535
- source = '.send[arguments=:create]:nth-child(1)'
536
- expected_tokens = [
537
- [:tNODE_TYPE, "send"],
538
- [:tOPEN_ATTRIBUTE, "["],
539
- [:tKEY, "arguments"],
540
- [:tEQUAL, "="],
541
- [:tSYMBOL, :create],
542
- [:tCLOSE_ATTRIBUTE, "]"],
543
- [:tINDEX, 0]
544
- ]
545
- assert_tokens source, expected_tokens
546
- end
547
-
548
- it 'matches :nth-last-child(1)' do
549
- source = '.send[arguments=:create]:nth-last-child(1)'
550
- expected_tokens = [
551
- [:tNODE_TYPE, "send"],
552
- [:tOPEN_ATTRIBUTE, "["],
553
- [:tKEY, "arguments"],
554
- [:tEQUAL, "="],
555
- [:tSYMBOL, :create],
556
- [:tCLOSE_ATTRIBUTE, "]"],
557
- [:tINDEX, -1]
558
- ]
559
- assert_tokens source, expected_tokens
560
- end
561
- end
562
-
563
505
  context 'descendant' do
564
506
  it 'matches' do
565
507
  source = '.class .send'
@@ -571,7 +513,7 @@ module Synvert::Core::NodeQuery
571
513
  context 'child' do
572
514
  it 'matches' do
573
515
  source = '.def > .send'
574
- expected_tokens = [[:tNODE_TYPE, "def"], [:tCHILD, ">"], [:tNODE_TYPE, "send"]]
516
+ expected_tokens = [[:tNODE_TYPE, "def"], [:tRELATIONSHIP, ">"], [:tNODE_TYPE, "send"]]
575
517
  assert_tokens source, expected_tokens
576
518
  end
577
519
  end
@@ -579,7 +521,7 @@ module Synvert::Core::NodeQuery
579
521
  context 'subsequent sibling' do
580
522
  it 'matches' do
581
523
  source = '.send ~ .send'
582
- expected_tokens = [[:tNODE_TYPE, "send"], [:tSUBSEQUENT_SIBLING, "~"], [:tNODE_TYPE, "send"]]
524
+ expected_tokens = [[:tNODE_TYPE, "send"], [:tRELATIONSHIP, "~"], [:tNODE_TYPE, "send"]]
583
525
  assert_tokens source, expected_tokens
584
526
  end
585
527
  end
@@ -587,7 +529,7 @@ module Synvert::Core::NodeQuery
587
529
  context 'next sibling' do
588
530
  it 'matches' do
589
531
  source = '.send + .send'
590
- expected_tokens = [[:tNODE_TYPE, "send"], [:tNEXT_SIBLING, "+"], [:tNODE_TYPE, "send"]]
532
+ expected_tokens = [[:tNODE_TYPE, "send"], [:tRELATIONSHIP, "+"], [:tNODE_TYPE, "send"]]
591
533
  assert_tokens source, expected_tokens
592
534
  end
593
535
  end
@@ -599,7 +541,7 @@ module Synvert::Core::NodeQuery
599
541
  [:tNODE_TYPE, "class"],
600
542
  [:tPSEUDO_CLASS, "has"],
601
543
  [:tOPEN_SELECTOR, "("],
602
- [:tCHILD, ">"],
544
+ [:tRELATIONSHIP, ">"],
603
545
  [:tNODE_TYPE, "def"],
604
546
  [:tCLOSE_SELECTOR, ")"]
605
547
  ]
@@ -614,7 +556,7 @@ module Synvert::Core::NodeQuery
614
556
  [:tNODE_TYPE, "class"],
615
557
  [:tPSEUDO_CLASS, "not_has"],
616
558
  [:tOPEN_SELECTOR, "("],
617
- [:tCHILD, ">"],
559
+ [:tRELATIONSHIP, ">"],
618
560
  [:tNODE_TYPE, "def"],
619
561
  [:tCLOSE_SELECTOR, ")"]
620
562
  ]
@@ -624,13 +566,11 @@ module Synvert::Core::NodeQuery
624
566
 
625
567
  context 'goto_scope' do
626
568
  it 'matches' do
627
- source = '.block <body> > .def'
569
+ source = '.block body > .def'
628
570
  expected_tokens = [
629
571
  [:tNODE_TYPE, "block"],
630
- [:tOPEN_GOTO_SCOPE, "<"],
631
- [:tIDENTIFIER, "body"],
632
- [:tCLOSE_GOTO_SCOPE, ">"],
633
- [:tCHILD, ">"],
572
+ [:tGOTO_SCOPE, "body"],
573
+ [:tRELATIONSHIP, ">"],
634
574
  [:tNODE_TYPE, "def"]
635
575
  ]
636
576
  assert_tokens source, expected_tokens