File tree Expand file tree Collapse file tree 7 files changed +43
-69
lines changed Expand file tree Collapse file tree 7 files changed +43
-69
lines changed Original file line number Diff line number Diff line change 22
22
bundler-cache : true
23
23
- name : Run tests
24
24
run : bundle exec rake
25
- - name : Run tests for siblings
26
- run : TEST_SIBLINGS=true bundle exec rake
27
25
28
26
deploy :
29
27
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 38
38
end
39
39
end
40
40
41
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
42
- require 'parser_node_ext/parent_node_ext'
43
-
44
- describe "#get_siblings" do
45
- it "gets the siblings of node" do
46
- node = parser_parse ( "class Synvert; end" ) . children . first
47
- expect ( adapter . get_siblings ( node ) ) . to eq [ nil , nil ]
48
- end
41
+ describe "#get_siblings" do
42
+ it "gets the siblings of node" do
43
+ node = parser_parse ( "class Synvert; end" ) . children . first
44
+ expect ( adapter . get_siblings ( node ) ) . to eq [ nil , nil ]
49
45
end
50
46
end
51
47
end
Original file line number Diff line number Diff line change 43
43
end
44
44
end
45
45
46
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
47
- require 'prism_ext/parent_node_ext'
48
-
49
- describe "#get_siblings" do
50
- it "gets the siblings of node" do
51
- node = prism_parse ( "class Synvert; end" ) . body . first . constant_path
52
- siblings = adapter . get_siblings ( node )
53
- expect ( siblings . size ) . to eq 5
54
- expect ( siblings [ 0 ] ) . to be_nil
55
- expect ( siblings [ 1 ] ) . to be_nil
56
- expect ( siblings [ 4 ] ) . to eq :Synvert
57
- end
46
+ describe "#get_siblings" do
47
+ it "gets the siblings of node" do
48
+ node = prism_parse ( "class Synvert; end" ) . body . first . constant_path
49
+ siblings = adapter . get_siblings ( node )
50
+ expect ( siblings . size ) . to eq 5
51
+ expect ( siblings [ 0 ] ) . to be_nil
52
+ expect ( siblings [ 1 ] ) . to be_nil
53
+ expect ( siblings [ 4 ] ) . to eq :Synvert
58
54
end
59
55
end
60
56
end
Original file line number Diff line number Diff line change 42
42
end
43
43
end
44
44
45
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
46
- require 'syntax_tree_ext/parent_node_ext'
47
-
48
- describe "#get_siblings" do
49
- it "gets the siblings of node" do
50
- node = syntax_tree_parse ( "class Synvert; end" ) . body . first . constant
51
- siblings = adapter . get_siblings ( node )
52
- expect ( siblings . size ) . to eq 2
53
- expect ( siblings [ 0 ] ) . to be_nil
54
- expect ( siblings [ 1 ] . class ) . to eq SyntaxTree ::BodyStmt
55
- end
45
+ describe "#get_siblings" do
46
+ it "gets the siblings of node" do
47
+ node = syntax_tree_parse ( "class Synvert; end" ) . body . first . constant
48
+ siblings = adapter . get_siblings ( node )
49
+ expect ( siblings . size ) . to eq 2
50
+ expect ( siblings [ 0 ] ) . to be_nil
51
+ expect ( siblings [ 1 ] . class ) . to eq SyntaxTree ::BodyStmt
56
52
end
57
53
end
58
54
end
Original file line number Diff line number Diff line change @@ -145,18 +145,14 @@ def initialize(id, name)
145
145
expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . first . body . first ]
146
146
end
147
147
148
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
149
- require 'parser_node_ext/parent_node_ext'
150
-
151
- it 'matches next sibling node' do
152
- expression = parser . parse ( '.ivasgn[variable=@id] + .ivasgn[variable=@name]' )
153
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . first . body [ 1 ] ]
154
- end
155
-
156
- it 'matches sebsequent sibling node' do
157
- expression = parser . parse ( '.ivasgn[variable=@id] ~ .ivasgn[variable=@name]' )
158
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . first . body [ 1 ] ]
159
- end
148
+ it 'matches next sibling node' do
149
+ expression = parser . parse ( '.ivasgn[variable=@id] + .ivasgn[variable=@name]' )
150
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . first . body [ 1 ] ]
151
+ end
152
+
153
+ it 'matches sebsequent sibling node' do
154
+ expression = parser . parse ( '.ivasgn[variable=@id] ~ .ivasgn[variable=@name]' )
155
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . first . body [ 1 ] ]
160
156
end
161
157
162
158
it 'matches goto scope' do
Original file line number Diff line number Diff line change @@ -148,18 +148,14 @@ def initialize(id, name)
148
148
expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . body . first . body . body . first . value ]
149
149
end
150
150
151
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
152
- require 'prism_ext/parent_node_ext'
153
-
154
- it 'matches next sibling node' do
155
- expression = parser . parse ( '.instance_variable_write_node[name=@id] + .instance_variable_write_node[name=@name]' )
156
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . body . first . body . body . last ]
157
- end
158
-
159
- it 'matches sebsequent sibling node' do
160
- expression = parser . parse ( '.instance_variable_write_node[name=@id] ~ .instance_variable_write_node[name=@name]' )
161
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . body . first . body . body . last ]
162
- end
151
+ it 'matches next sibling node' do
152
+ expression = parser . parse ( '.instance_variable_write_node[name=@id] + .instance_variable_write_node[name=@name]' )
153
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . body . first . body . body . last ]
154
+ end
155
+
156
+ it 'matches sebsequent sibling node' do
157
+ expression = parser . parse ( '.instance_variable_write_node[name=@id] ~ .instance_variable_write_node[name=@name]' )
158
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . body . body . first . body . body . last ]
163
159
end
164
160
165
161
it 'matches goto scope' do
Original file line number Diff line number Diff line change @@ -148,18 +148,14 @@ def initialize(id, name)
148
148
expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . bodystmt . statements . body . first . bodystmt . statements . body . first . target ]
149
149
end
150
150
151
- if ENV [ 'TEST_SIBLINGS' ] == 'true'
152
- require 'syntax_tree_ext/parent_node_ext'
153
-
154
- it 'matches next sibling node' do
155
- expression = parser . parse ( '.Assign[target=@id] + .Assign[target=@name]' )
156
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . bodystmt . statements . body . first . bodystmt . statements . body . last ]
157
- end
158
-
159
- it 'matches sebsequent sibling node' do
160
- expression = parser . parse ( '.Assign[target=@id] ~ .Assign[target=@name]' )
161
- expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . bodystmt . statements . body . first . bodystmt . statements . body . last ]
162
- end
151
+ it 'matches next sibling node' do
152
+ expression = parser . parse ( '.Assign[target=@id] + .Assign[target=@name]' )
153
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . bodystmt . statements . body . first . bodystmt . statements . body . last ]
154
+ end
155
+
156
+ it 'matches sebsequent sibling node' do
157
+ expression = parser . parse ( '.Assign[target=@id] ~ .Assign[target=@name]' )
158
+ expect ( expression . query_nodes ( node ) ) . to eq [ node . body . first . bodystmt . statements . body . first . bodystmt . statements . body . last ]
163
159
end
164
160
165
161
it 'matches goto scope' do
You can’t perform that action at this time.
0 commit comments