@@ -52,7 +52,7 @@ test('comparison tests', function (t) {
52
52
[ '1.2.3-a.b' , '1.2.3-a' ] ,
53
53
[ '1.2.3-a.b.c.10.d.5' , '1.2.3-a.b.c.5.d.100' ] ,
54
54
[ '1.2.3-r2' , '1.2.3-r100' ] ,
55
- [ '1.2.3-r100' , '1.2.3-R2' ]
55
+ [ '1.2.3-r100' , '1.2.3-R2' ] ,
56
56
] . forEach ( function ( v ) {
57
57
var v0 = v [ 0 ]
58
58
var v1 = v [ 1 ]
@@ -333,7 +333,6 @@ test('negative range tests', function (t) {
333
333
[ 'blerg' , '1.2.3' ] ,
334
334
[ 'git+https://user:[email protected] /foo' , '123.0.0' , true ] ,
335
335
[ '^1.2.3' , '2.0.0-pre' ] ,
336
- [ '^1.2.3' , false ]
337
336
] . forEach ( function ( v ) {
338
337
var range = v [ 0 ]
339
338
var ver = v [ 1 ]
@@ -919,31 +918,74 @@ test('ranges intersect', function (t) {
919
918
[ '<1.6.16 || >=1.7.0 <1.7.11 || >=1.8.0 <1.8.2' , '>=1.6.16 <1.7.0 || >=1.7.11 <1.8.0 || >=1.8.2' , false ] ,
920
919
[ '<=1.6.16 || >=1.7.0 <1.7.11 || >=1.8.0 <1.8.2' , '>=1.6.16 <1.7.0 || >=1.7.11 <1.8.0 || >=1.8.2' , true ] ,
921
920
[ '>=1.0.0' , '<=1.0.0' , true ] ,
922
- [ '>1.0.0 <1.0.0' , '<=0.0.0' , false ]
921
+ [ '>1.0.0 <1.0.0' , '<=0.0.0' , false ] ,
922
+ [ '*' , '0.0.1' , true ] ,
923
+ [ '*' , '>=1.0.0' , true ] ,
924
+ [ '*' , '>1.0.0' , true ] ,
925
+ [ '*' , '~1.0.0' , true ] ,
926
+ [ '*' , '<1.6.0' , true ] ,
927
+ [ '*' , '<=1.6.0' , true ] ,
928
+ [ '1.*' , '0.0.1' , false ] ,
929
+ [ '1.*' , '2.0.0' , false ] ,
930
+ [ '1.*' , '1.0.0' , true ] ,
931
+ [ '1.*' , '<2.0.0' , true ] ,
932
+ [ '1.*' , '>1.0.0' , true ] ,
933
+ [ '1.*' , '<=1.0.0' , true ] ,
934
+ [ '1.*' , '^1.0.0' , true ] ,
935
+ [ '1.0.*' , '0.0.1' , false ] ,
936
+ [ '1.0.*' , '<0.0.1' , false ] ,
937
+ [ '1.0.*' , '>0.0.1' , true ] ,
938
+ [ '*' , '1.3.0 || <1.0.0 >2.0.0' , true ] ,
939
+ [ '1.3.0 || <1.0.0 >2.0.0' , '*' , true ] ,
940
+ [ '1.*' , '1.3.0 || <1.0.0 >2.0.0' , true ] ,
941
+ [ 'x' , '0.0.1' , true ] ,
942
+ [ 'x' , '>=1.0.0' , true ] ,
943
+ [ 'x' , '>1.0.0' , true ] ,
944
+ [ 'x' , '~1.0.0' , true ] ,
945
+ [ 'x' , '<1.6.0' , true ] ,
946
+ [ 'x' , '<=1.6.0' , true ] ,
947
+ [ '1.x' , '0.0.1' , false ] ,
948
+ [ '1.x' , '2.0.0' , false ] ,
949
+ [ '1.x' , '1.0.0' , true ] ,
950
+ [ '1.x' , '<2.0.0' , true ] ,
951
+ [ '1.x' , '>1.0.0' , true ] ,
952
+ [ '1.x' , '<=1.0.0' , true ] ,
953
+ [ '1.x' , '^1.0.0' , true ] ,
954
+ [ '1.0.x' , '0.0.1' , false ] ,
955
+ [ '1.0.x' , '<0.0.1' , false ] ,
956
+ [ '1.0.x' , '>0.0.1' , true ] ,
957
+ [ 'x' , '1.3.0 || <1.0.0 >2.0.0' , true ] ,
958
+ [ '1.3.0 || <1.0.0 >2.0.0' , 'x' , true ] ,
959
+ [ '1.x' , '1.3.0 || <1.0.0 >2.0.0' , true ] ,
960
+ [ '*' , '*' , true ] ,
961
+ [ 'x' , '' , true ] ,
923
962
] . forEach ( function ( v ) {
924
- var range1 = new Range ( v [ 0 ] )
925
- var range2 = new Range ( v [ 1 ] )
926
- var expect = v [ 2 ]
927
- var actual1 = range1 . intersects ( range2 )
928
- var actual2 = range2 . intersects ( range1 )
929
- var actual3 = semver . intersects ( v [ 1 ] , v [ 0 ] )
930
- var actual4 = semver . intersects ( v [ 0 ] , v [ 1 ] )
931
- var actual5 = semver . intersects ( v [ 1 ] , v [ 0 ] , true )
932
- var actual6 = semver . intersects ( v [ 0 ] , v [ 1 ] , true )
933
- var actual7 = semver . intersects ( range1 , range2 )
934
- var actual8 = semver . intersects ( range2 , range1 )
935
- var actual9 = semver . intersects ( range1 , range2 , true )
936
- var actual0 = semver . intersects ( range2 , range1 , true )
937
- t . equal ( actual1 , expect )
938
- t . equal ( actual2 , expect )
939
- t . equal ( actual3 , expect )
940
- t . equal ( actual4 , expect )
941
- t . equal ( actual5 , expect )
942
- t . equal ( actual6 , expect )
943
- t . equal ( actual7 , expect )
944
- t . equal ( actual8 , expect )
945
- t . equal ( actual9 , expect )
946
- t . equal ( actual0 , expect )
963
+ t . test ( v [ 0 ] + ' <~> ' + v [ 1 ] , t => {
964
+ var range1 = new Range ( v [ 0 ] )
965
+ var range2 = new Range ( v [ 1 ] )
966
+ var expect = v [ 2 ]
967
+ var actual1 = range1 . intersects ( range2 )
968
+ var actual2 = range2 . intersects ( range1 )
969
+ var actual3 = semver . intersects ( v [ 1 ] , v [ 0 ] )
970
+ var actual4 = semver . intersects ( v [ 0 ] , v [ 1 ] )
971
+ var actual5 = semver . intersects ( v [ 1 ] , v [ 0 ] , true )
972
+ var actual6 = semver . intersects ( v [ 0 ] , v [ 1 ] , true )
973
+ var actual7 = semver . intersects ( range1 , range2 )
974
+ var actual8 = semver . intersects ( range2 , range1 )
975
+ var actual9 = semver . intersects ( range1 , range2 , true )
976
+ var actual0 = semver . intersects ( range2 , range1 , true )
977
+ t . equal ( actual1 , expect )
978
+ t . equal ( actual2 , expect )
979
+ t . equal ( actual3 , expect )
980
+ t . equal ( actual4 , expect )
981
+ t . equal ( actual5 , expect )
982
+ t . equal ( actual6 , expect )
983
+ t . equal ( actual7 , expect )
984
+ t . equal ( actual8 , expect )
985
+ t . equal ( actual9 , expect )
986
+ t . equal ( actual0 , expect )
987
+ t . end ( )
988
+ } )
947
989
} )
948
990
t . end ( )
949
991
} )
0 commit comments