This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,51 @@ module Support
131
131
end
132
132
end
133
133
end
134
+
135
+ describe 'Ripper' do
136
+ let ( :line_number ) do
137
+ token = tokens . first
138
+ location = token . first
139
+ location . first
140
+ end
141
+
142
+ let ( :tokens ) do
143
+ require 'ripper'
144
+ Ripper . lex ( 'foo' )
145
+ end
146
+
147
+ if Ruby . mri?
148
+ context 'on MRI' do
149
+ context '1.8.x' , :if => RUBY_VERSION . start_with? ( '1.8.' ) do
150
+ it 'is not supported' do
151
+ expect { tokens } . to raise_error ( LoadError )
152
+ end
153
+ end
154
+
155
+ context '1.9.x or later' , :if => RUBY_VERSION >= '1.9' do
156
+ it 'is supported' do
157
+ expect ( line_number ) . to eq ( 1 )
158
+ end
159
+ end
160
+ end
161
+ end
162
+
163
+ if Ruby . jruby? && RUBY_VERSION >= '1.9.0'
164
+ context 'on JRuby' do
165
+ context '1.7.x' , :if => JRUBY_VERSION . start_with? ( '1.7.' ) do
166
+ it 'is supported' do
167
+ expect ( line_number ) . to eq ( 1 )
168
+ end
169
+ end
170
+
171
+ context '9.x.x.x' , :if => JRUBY_VERSION . start_with? ( '9.' ) do
172
+ it 'reports wrong line number' do
173
+ expect ( line_number ) . to eq ( 2 )
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
134
179
end
135
180
end
136
181
end
You can’t perform that action at this time.
0 commit comments