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 +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,59 @@ module Support
86
86
it 'does not load Ripper' do
87
87
expect { RubyFeatures . ripper_supported? } . not_to change { defined? ( ::Ripper ) }
88
88
end
89
+
90
+ describe 'Ripper' do
91
+ let ( :line_number ) do
92
+ token = tokens . first
93
+ location = token . first
94
+ location . first
95
+ end
96
+
97
+ let ( :tokens ) do
98
+ require 'ripper'
99
+ ::Ripper . lex ( 'foo' )
100
+ end
101
+
102
+ if Ruby . mri?
103
+ context 'on MRI' do
104
+ context '1.8.x' , :if => RUBY_VERSION . start_with? ( '1.8.' ) do
105
+ it 'is not supported' do
106
+ expect { tokens } . to raise_error ( LoadError )
107
+ end
108
+ end
109
+
110
+ context '1.9.x or later' , :if => RUBY_VERSION >= '1.9' do
111
+ it 'is supported' do
112
+ expect ( line_number ) . to eq ( 1 )
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+ if Ruby . jruby?
119
+ context 'on JRuby' do
120
+ context '1.7.x' , :if => JRUBY_VERSION . start_with? ( '1.7.' ) do
121
+ context 'in 1.8 mode' , :if => RUBY_VERSION . start_with? ( '1.8.' ) do
122
+ it 'is not supported' do
123
+ expect { tokens } . to raise_error ( NameError )
124
+ end
125
+ end
126
+
127
+ context 'in non 1.8 mode' , :unless => RUBY_VERSION . start_with? ( '1.8.' ) do
128
+ it 'is supported' do
129
+ expect ( line_number ) . to eq ( 1 )
130
+ end
131
+ end
132
+ end
133
+
134
+ context '9.x.x.x' , :if => JRUBY_VERSION . start_with? ( '9.' ) do
135
+ it 'reports wrong line number' do
136
+ expect ( line_number ) . to eq ( 2 )
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
89
142
end
90
143
end
91
144
end
You can’t perform that action at this time.
0 commit comments