Skip to content

Commit 91d86aa

Browse files
committed
Fix test cases involving spaced hashes
1 parent 5fbcb97 commit 91d86aa

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ def tokens
8787

8888
def ws(obj) puts Wirb::Tokenizer.run(obj.inspect).map{|*x| x.inspect + ','}*$/ end
8989

90-
def hash34?
90+
def spaced_hashes?
9191
RUBY_VERSION >= "3.4.0"
9292
end

spec/tokenizer_enumerator_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
[:whitespace, " "],
5555
[:open_hash, "{"],
5656
[:number, "1"],
57-
([:whitespace, " "] if hash34?),
57+
([:whitespace, " "] if spaced_hashes?),
5858
[:refers, "=>"],
59-
([:whitespace, " "] if hash34?),
59+
([:whitespace, " "] if spaced_hashes?),
6060
[:number, "3"],
6161
[:close_hash, "}"],
6262
[:object_description, ":each"],
@@ -76,9 +76,9 @@
7676
[:whitespace, " "],
7777
[:open_hash, "{"],
7878
[:number, "1"],
79-
([:whitespace, " "] if hash34?),
79+
([:whitespace, " "] if spaced_hashes?),
8080
[:refers, "=>"],
81-
([:whitespace, " "] if hash34?),
81+
([:whitespace, " "] if spaced_hashes?),
8282
[:number, "3"],
8383
[:close_hash, "}"],
8484
[:object_description, ":each"],
@@ -105,9 +105,9 @@
105105
[:open_set, "{"],
106106
[:open_hash, "{"],
107107
[:number, "1"],
108-
([:whitespace, " "] if hash34?),
108+
([:whitespace, " "] if spaced_hashes?),
109109
[:refers, "=>"],
110-
([:whitespace, " "] if hash34?),
110+
([:whitespace, " "] if spaced_hashes?),
111111
[:number, "2"],
112112
[:close_hash, "}"],
113113
[:close_set, "}"],
@@ -148,9 +148,9 @@
148148
[:open_array, "["],
149149
[:open_hash, "{"],
150150
[:number, "1"],
151-
([:whitespace, " "] if hash34?),
151+
([:whitespace, " "] if spaced_hashes?),
152152
[:refers, "=>"],
153-
([:whitespace, " "] if hash34?),
153+
([:whitespace, " "] if spaced_hashes?),
154154
[:number, "2"],
155155
[:close_hash, "}"],
156156
[:comma, ","],

spec/tokenizer_hash_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
tokens.should == [
88
[:open_hash, "{"],
99
[:number, "1"],
10-
([:whitespace, " "] if hash34?),
10+
([:whitespace, " "] if spaced_hashes?),
1111
[:refers, "=>"],
12-
([:whitespace, " "] if hash34?),
12+
([:whitespace, " "] if spaced_hashes?),
1313
[:number, "2"],
1414
[:close_hash, "}"],
1515
].compact
@@ -24,9 +24,9 @@
2424
# [:refers, "=>"],
2525
# [:open_hash, "{"],
2626
# [:number, "1"],
27-
# ([:whitespace, " "] if hash34?),
27+
# ([:whitespace, " "] if spaced_hashes?),
2828
# [:refers, "=>"],
29-
# ([:whitespace, " "] if hash34?),
29+
# ([:whitespace, " "] if spaced_hashes?),
3030
# [:open_object, "#<"],
3131
# [:object_class, "Set"],
3232
# [:object_description_prefix, ":"],
@@ -63,7 +63,7 @@
6363
[:refers, "=>"],
6464
[:refers, "=>"],
6565
[:refers, "=>"],
66-
*([[:whitespace, " "]] * (hash34? ? 8 : 2))
66+
*([[:whitespace, " "]] * (spaced_hashes? ? 8 : 2))
6767
]
6868
end
6969
end

spec/tokenizer_nested_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
[:open_hash, "{"],
3737
[:open_hash, "{"],
3838
[:number, "5"],
39-
[:whitespace, " "],
39+
([:whitespace, " "] if spaced_hashes?),
4040
[:refers, "=>"],
41-
[:whitespace, " "],
41+
([:whitespace, " "] if spaced_hashes?),
4242
[:open_string, "\""],
4343
[:string, "4"],
4444
[:close_string, "\""],
4545
[:close_hash, "}"],
46-
[:whitespace, " "],
46+
([:whitespace, " "] if spaced_hashes?),
4747
[:refers, "=>"],
48-
[:whitespace, " "],
48+
([:whitespace, " "] if spaced_hashes?),
4949
[:open_hash, "{"],
5050
[:open_object, "#<"],
5151
[:object_class, "Set"],
@@ -54,9 +54,9 @@
5454
[:open_set, "{"],
5555
[:close_set, "}"],
5656
[:close_object, ">"],
57-
[:whitespace, " "],
57+
([:whitespace, " "] if spaced_hashes?),
5858
[:refers, "=>"],
59-
[:whitespace, " "],
59+
([:whitespace, " "] if spaced_hashes?),
6060
[:open_object, "#<"],
6161
[:object_class, "Object"],
6262
[:object_description_prefix, ":"],
@@ -65,6 +65,6 @@
6565
[:close_hash, "}"],
6666
[:close_hash, "}"],
6767
[:close_array, "]"],
68-
]
68+
].compact
6969
end
7070
end

spec/tokenizer_set_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
[:whitespace, " "],
4949
[:whitespace, " "],
5050
[:whitespace, " "],
51-
([:whitespace, " "] if hash34?),
52-
([:whitespace, " "] if hash34?),
53-
([:whitespace, " "] if hash34?),
54-
([:whitespace, " "] if hash34?),
51+
([:whitespace, " "] if spaced_hashes?),
52+
([:whitespace, " "] if spaced_hashes?),
53+
([:whitespace, " "] if spaced_hashes?),
54+
([:whitespace, " "] if spaced_hashes?),
5555
].compact
5656
end
5757
end

0 commit comments

Comments
 (0)