You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it "warns on single-letter macro lowercase fresh variables with indices"do
68
+
chars = ('a'..'z').to_a -VALID_SIGILS
72
69
chars.each do |letter|
73
70
assert_parser_warning <<-CRYSTAL, "Warning: single-letter macro fresh variables with indices are deprecated"
74
71
macro foo
@@ -78,6 +75,17 @@ describe "Parser warnings" do
78
75
end
79
76
end
80
77
78
+
it "warns on single-letter uppercase macro fresh variables with indices"do
79
+
chars = ('A'..'Z').to_a.push('Dz') -VALID_SIGILS
80
+
chars.each do |letter|
81
+
assert_parser_warning <<-CRYSTAL, "Warning: macro fresh variables with constant names are deprecated", "Warning: single-letter macro fresh variables with indices are deprecated"
82
+
macro foo
83
+
%#{letter}{1} = 2
84
+
end
85
+
CRYSTAL
86
+
end
87
+
end
88
+
81
89
it "doesn't warn on sigils that resemble single-letter macro fresh variables with indices"do
82
90
VALID_SIGILS.each do |letter|
83
91
assert_no_parser_warning <<-CRYSTAL
@@ -88,12 +96,22 @@ describe "Parser warnings" do
88
96
end
89
97
end
90
98
91
-
it "doesn't warn on single-letter macro fresh variables without indices"do
92
-
('A'..'Z').each do |letter|
99
+
it "warns on single-letter uppercase macro fresh variables without indices"do
100
+
chars = ('A'..'Z').to_a.push('Dz')
101
+
chars.each do |letter|
102
+
assert_parser_warning <<-CRYSTAL, "Warning: macro fresh variables with constant names are deprecated"
103
+
macro foo
104
+
%#{letter} = 1
105
+
end
106
+
CRYSTAL
107
+
end
108
+
end
109
+
110
+
it "doesn't warn on single-letter lowercase macro fresh variables without indices"do
0 commit comments