File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed
jruby-gradle-base-plugin/src
main/groovy/com/github/jrubygradle/internal
test/groovy/com/github/jrubygradle/internal Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -169,27 +169,13 @@ class GemVersion {
169
169
return 1
170
170
}
171
171
172
- def aaObject
173
- def bbObject
174
-
175
172
if (aDigits[index]. isInteger() && bDigits[index]. isInteger()) {
176
173
// compare them as number
177
- aaObject = aDigits[index] as int
178
- bbObject = bDigits[index] as int
174
+ aDigits[index] as int <=> bDigits[index] as int
179
175
}
180
176
else {
181
177
// compare them as string
182
- aaObject = aDigits[index]
183
- bbObject = bDigits[index]
184
- }
185
- if (aaObject < bbObject) {
186
- -1
187
- }
188
- else if (aaObject > bbObject) {
189
- 1
190
- }
191
- else {
192
- 0
178
+ aDigits[index] <=> bDigits[index]
193
179
}
194
180
}
195
181
Original file line number Diff line number Diff line change @@ -179,23 +179,23 @@ class GemVersionSpec extends Specification {
179
179
subject. intersect(' [1.2.4, 1.2.4]' ). conflict() == true
180
180
}
181
181
182
- def " passes non-integer version ranges with no conflicts " () {
182
+ def " finds no conflicts in non-integer version ranges" () {
183
183
given :
184
184
GemVersion subject = new GemVersion (' [1.2.bar, 1.2.foo]' )
185
185
186
186
expect :
187
187
! subject. conflict()
188
188
}
189
189
190
- def " fails non-integer version ranges with conflicts " () {
190
+ def " finds conflicts in non-integer version ranges" () {
191
191
given :
192
192
GemVersion subject = new GemVersion (' [1.2.foo, 1.2.bar]' )
193
193
194
194
expect :
195
195
subject. conflict()
196
196
}
197
197
198
- def " it does not throw an exception for a '+' version" () {
198
+ def " does not throw an exception for a '+' version" () {
199
199
when :
200
200
new GemVersion (' +' ). conflict()
201
201
You can’t perform that action at this time.
0 commit comments