Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a4e61ed

Browse files
committed
Strip out old tests
1 parent 7da6924 commit a4e61ed

File tree

3 files changed

+0
-111
lines changed

3 files changed

+0
-111
lines changed

bin/test

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,6 @@ END {
3232
end
3333

3434
puts failures
35-
36-
Prism::TESTS.each do |clazz, cases|
37-
cases.each do |(output, input, block)|
38-
output = output.gsub("{{long}}", "a" * 80)
39-
result = Prism.parse(input.gsub("{{long}}", "a" * 80))
40-
41-
node = result.value.statements.body.last
42-
node = block.call(node) if block
43-
raise "expected `#{clazz}`, got `#{node.class}`" if !node.is_a?(clazz)
44-
45-
actual = result.format.chomp
46-
raise "expected:\n#{output}\n\ngot:\n#{actual}\n" if actual != output
47-
end
48-
end
4935
}
5036

5137
__END__

lib/syntax_tree/prism.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ def format
1515
formatter.output.join
1616
end
1717
end
18-
19-
TESTS = {}
20-
21-
class Node
22-
def self.test(output, input = output, &block)
23-
(TESTS[self] ||= []) << [output, input, block]
24-
end
25-
end
2618
end
2719

2820
require "syntax_tree/prism/formatter"

lib/syntax_tree/prism/nodes.rb

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -198,31 +198,6 @@ def format(q)
198198
q.text("]")
199199
end
200200
end
201-
202-
test("[]")
203-
test("[ # comment\n]")
204-
test("[\n # comment1\n # comment2\n]")
205-
test("[] # comment")
206-
test("[\n {{long}}\n] # comment")
207-
208-
test("[1, 2, 3]")
209-
test("[1, 2, 3]", "[1, 2, 3,]")
210-
test("[\n 1,\n {{long}},\n 3\n]", "[1, {{long}}, 3]")
211-
212-
test("%w[foo bar baz]")
213-
test("%w[\n foo\n {{long}}\n baz\n]", "%w[foo {{long}} baz]")
214-
215-
test("%W[foo bar baz]")
216-
test("%W[\n foo\n {{long}}\n baz\n]", "%W[foo {{long}} baz]")
217-
218-
test("%i[foo bar baz]")
219-
test("%i[\n foo\n {{long}}\n baz\n]", "%i[foo {{long}} baz]")
220-
221-
test("%I[foo bar baz]")
222-
test("%I[\n foo\n {{long}}\n baz\n]", "%I[foo {{long}} baz]")
223-
224-
test("foo = 1, 2, 3", &:value)
225-
test("foo =\n 1,\n 2, # comment\n 3", "foo = 1, 2, # comment\n3", &:value)
226201
end
227202

228203
class ArrayPatternNode
@@ -288,10 +263,6 @@ class AssocSplatNode
288263
def format(q)
289264
q.format_prefix(operator_loc, value)
290265
end
291-
292-
test("foo in { bar: :baz, ** }") { |node| node.pattern.assocs.last }
293-
test("{ **foo }") { |node| node.elements.first }
294-
test("{\n ** # comment\n foo\n}", "{ ** # comment\nfoo }") { |node| node.elements.first }
295266
end
296267

297268
class BackReferenceReadNode
@@ -302,9 +273,6 @@ class BackReferenceReadNode
302273
def format(q)
303274
q.text(slice)
304275
end
305-
306-
test("$+")
307-
test("$+ # comment")
308276
end
309277

310278
class BeginNode
@@ -395,8 +363,6 @@ class BlockLocalVariableNode
395363
def format(q)
396364
q.text(name.name)
397365
end
398-
399-
test("a { |; b| }") { |node| node.block.parameters.locals.first }
400366
end
401367

402368
class BlockNode
@@ -888,9 +854,6 @@ class ClassVariableReadNode
888854
def format(q)
889855
q.text(name.name)
890856
end
891-
892-
test("@@foo")
893-
test("@@foo # comment")
894857
end
895858

896859
class ClassVariableTargetNode
@@ -902,8 +865,6 @@ class ClassVariableTargetNode
902865
def format(q)
903866
q.text(name.name)
904867
end
905-
906-
test("@@foo, @@bar = baz") { |node| node.targets.first }
907868
end
908869

909870
class ClassVariableWriteNode
@@ -914,10 +875,6 @@ class ClassVariableWriteNode
914875
def format(q)
915876
q.format_write(operator_loc, value) { q.text(name.name) }
916877
end
917-
918-
test("@@foo = 1")
919-
test("@@foo = # comment\n 1")
920-
test("@@foo = 1 # comment")
921878
end
922879

923880
class ClassVariableAndWriteNode
@@ -929,10 +886,6 @@ class ClassVariableAndWriteNode
929886
def format(q)
930887
q.format_write(operator_loc, value) { q.text(name.name) }
931888
end
932-
933-
test("@@foo &&= 1")
934-
test("@@foo &&= # comment\n 1")
935-
test("@@foo &&= 1 # comment")
936889
end
937890

938891
class ClassVariableOrWriteNode
@@ -944,10 +897,6 @@ class ClassVariableOrWriteNode
944897
def format(q)
945898
q.format_write(operator_loc, value) { q.text(name.name) }
946899
end
947-
948-
test("@@foo ||= 1")
949-
test("@@foo ||= # comment\n 1")
950-
test("@@foo ||= 1 # comment")
951900
end
952901

953902
class ClassVariableOperatorWriteNode
@@ -958,10 +907,6 @@ class ClassVariableOperatorWriteNode
958907
def format(q)
959908
q.format_write(operator_loc, value) { q.text(name.name) }
960909
end
961-
962-
test("@@foo += 1")
963-
test("@@foo += # comment\n 1")
964-
test("@@foo += 1 # comment")
965910
end
966911

967912
class ConstantReadNode
@@ -972,9 +917,6 @@ class ConstantReadNode
972917
def format(q)
973918
q.text(name.name)
974919
end
975-
976-
test("Foo")
977-
test("Foo # comment")
978920
end
979921

980922
class ConstantTargetNode
@@ -986,8 +928,6 @@ class ConstantTargetNode
986928
def format(q)
987929
q.text(name.name)
988930
end
989-
990-
test("Foo, Bar = baz") { |node| node.targets.first }
991931
end
992932

993933
class ConstantWriteNode
@@ -998,10 +938,6 @@ class ConstantWriteNode
998938
def format(q)
999939
q.format_write(operator_loc, value) { q.text(name.name) }
1000940
end
1001-
1002-
test("Foo = 1")
1003-
test("Foo = # comment\n 1")
1004-
test("Foo = 1 # comment")
1005941
end
1006942

1007943
class ConstantAndWriteNode
@@ -1012,10 +948,6 @@ class ConstantAndWriteNode
1012948
def format(q)
1013949
q.format_write(operator_loc, value) { q.text(name.name) }
1014950
end
1015-
1016-
test("Foo &&= 1")
1017-
test("Foo &&= # comment\n 1")
1018-
test("Foo &&= 1 # comment")
1019951
end
1020952

1021953
class ConstantOrWriteNode
@@ -1026,10 +958,6 @@ class ConstantOrWriteNode
1026958
def format(q)
1027959
q.format_write(operator_loc, value) { q.text(name.name) }
1028960
end
1029-
1030-
test("Foo ||= 1")
1031-
test("Foo ||= # comment\n 1")
1032-
test("Foo ||= 1 # comment")
1033961
end
1034962

1035963
class ConstantOperatorWriteNode
@@ -1040,10 +968,6 @@ class ConstantOperatorWriteNode
1040968
def format(q)
1041969
q.format_write(operator_loc, value) { q.text(name.name) }
1042970
end
1043-
1044-
test("Foo += 1")
1045-
test("Foo += # comment\n 1")
1046-
test("Foo += 1 # comment")
1047971
end
1048972

1049973
class ConstantPathNode
@@ -1698,9 +1622,6 @@ class ImaginaryNode
16981622
def format(q)
16991623
q.text(slice)
17001624
end
1701-
1702-
test("1i")
1703-
test("1i # comment")
17041625
end
17051626

17061627
class ImplicitNode
@@ -2028,11 +1949,6 @@ def format(q)
20281949
q.text(slice)
20291950
end
20301951
end
2031-
2032-
test("1")
2033-
test("1 # comment")
2034-
test("1_2_3_4_5")
2035-
test("12_345", "12345")
20361952
end
20371953

20381954
class KeywordRestParameterNode
@@ -2585,11 +2501,6 @@ def format(q)
25852501
q.text(content)
25862502
q.text(closing)
25872503
end
2588-
2589-
test("/foo/i")
2590-
test("%r{foo}i")
2591-
test("/foo/i # comment")
2592-
test("%r{foo}i # comment")
25932504
end
25942505

25952506
class RequiredDestructuredParameterNode

0 commit comments

Comments
 (0)