# file : tests/standard-version/testscript # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file : valid : : Roundtrip version. : { : non-prerelease : $* <<EOF >>EOF 1.2.3 EOF : prerelease : { : final : $* <<EOF >>EOF 1.2.3-a.1 1.2.3-b.1 EOF : snapshot : $* <<EOF >>EOF 1.2.3-a.1.z 1.2.3-a.0.456 1.2.3-a.1.456.340c0a26a5ef EOF : earliest : $* <<EOF >>EOF 1.2.3- EOF } : revision : $* <<EOF >>EOF 1.2.3+4 1.2.3-a.4+5 1.2.3-a.4.z+5 1.2.3-a.4.567+8 1.2.3-a.4.567.340c0a26a5ef+8 EOF : epoch : $* <<EOF >>EOF 4~1.2.3 EOF : stub : $* <<EOF >>EOF 0 0+1 EOF : empty : $* <<EOF >>EOF EOF } : invalid : { : major : $* <'a' 2>'invalid major version' == 1 : no-major-dot : $* <'1' 2>"'.' expected after major version" == 1 : minor : $* <'1.a' 2>'invalid minor version' == 1 : no-minor-dot : $* <'1.2' 2>"'.' expected after minor version" == 1 : patch : $* <'1.2.a' 2>'invalid patch version' == 1 : zero-version : $* <'1~0.0.0' 2>'0.0.0 version' == 1 : a-b-expected : $* <'1.2.3-k' 2>"'a' or 'b' expected in pre-release" == 1 : prerelease-dot-expected : $* <'1.2.3-a' 2>"'.' expected after pre-release letter" == 1 : prerelease : $* <'1.2.3-a.b' 2>'invalid pre-release' == 1 : final-prerelease : $* <'1.2.3-b.0' 2>'invalid final pre-release' == 1 : snapshot-num : $* <'1.2.3-a.1.0' 2>'invalid snapshot number' == 1 : snapshot-id : $* <'1.2.3-a.1.1.@' 2>'invalid snapshot id' == 1 : revision : { : non-prerelease : $* <'1.2.3+a' 2>'invalid revision' == 1 : prerelease : $* <'1.2.3-a.1+a' 2>'invalid revision' == 1 : snapshot-num : $* <'1.2.3-a.0.1+a' 2>'invalid revision' == 1 : snapshot-id : $* <'1.2.3-a.0.1.83jdgsf+0' 2>'invalid revision' == 1 : earliest-prerelease : $* <'1.2.3-+1' 2>"'a' or 'b' expected in pre-release" == 1 } : trailing-junk-after : { : snapshot-num : $* <'1.2.3-a.1.z.a' 2>'junk after version' == 1 : revision : $* <'1.2.3-a.1.z+1a' 2>'junk after version' == 1 } } : alpha : { test.options += -a $* '1.2.3' >n: non-prerelease $* '1.2.3-b.1' >n: beta $* '1.2.3-a.1' >y: final $* '1.2.3-a.0.1' >y: snapshot $* '1.2.3-' >y: earliest $* '0' >n: stub } : beta : { test.options += -b $* '1.2.3' >n: non-prerelease $* '1.2.3-a.1' >n: alpha $* '1.2.3-b.1' >y: final $* '1.2.3-b.0.1' >y: snapshot $* '1.2.3-' >n: earliest $* '0+1' >n: stub } : compare : { test.options += -c : epoch : { $* '4~1.2.3' '4~1.2.3' >'0' : equal $* '1.2.4' '4~1.2.3' >'-1': less } : non-prerelease : { $* '1.2.3' '1.2.3' >'0' : equal $* '1.2.3' '1.2.4' >'-1' : less } : prerelease : { $* '1.2.3-a.1' '1.2.3-a.1' >'0' : equal $* '1.2.3' '1.2.3-a.1' >'1' : release-gt-prerelease $* '1.2.3-a.2' '1.2.3-b.1' >'-1' : a-lt-b $* '1.2.3-a.1' '1.2.3-a.1.2' >'-1' : final-lt-snapshot $* '1.2.3-a.1.2.xy' '1.2.3-a.1.2' >'0' : ignore-snapshot-id $* '1.2.3' '1.2.3-a.0.1' >'1' : release-gt-snapshot $* '1.2.3-a.0.1' '1.2.3-a.1' >'-1' : snapshot-lt-final $* '1.2.3' '1.2.3-' >'1' : release-gt-earliest $* '1.2.3-a.1' '1.2.3-' >'1' : final-gt-earliest $* '1.2.3-a.0.1' '1.2.3-' >'1' : snapshot-gt-earliest $* '1.2.2-b.499.z' '1.2.3-' >'-1' : prev-max-snapshot-lt-earliest } } : constraints : { test.options += -r : range : { : valid : $* <<EOI >>EOE [1.2.3 1.2.4] (1.2.3 1.2.4) [ 1.2.3- 1.2.4- ] EOI [1.2.3 1.2.4] (1.2.3 1.2.4) [1.2.3- 1.2.4-] EOE : invalid : { $* <'' 2>'invalid constraint' == 1 : empty $* <'1' 2>'invalid constraint' == 1 : no-opening $* <'[ ' 2>'no min version' == 1 : no-min $* <'[1.2.3' 2>'no max version' == 1 : no-max $* <'[1.2.3 1.2.4' 2>'no closing bracket' == 1 : no-closing $* <'[1.2.3 1.2.4)]' 2>'junk after constraint' == 1 : junk : invalid-min : $* <'[1' 2>"invalid min version: '.' expected after major version" == 1 : invalid-max : $* <'[1.2.3 1' 2>"invalid max version: '.' expected after major version" == 1 : min-gt-max : $* <'[1.2.4 1.2.3]' 2>'min version is greater than max version' == 1 : open-end : $* <'[1.2.3 1.2.3)' 2>'equal version endpoints not closed' == 1 : earliest-prerelease : $* <'[1.2.3- 1.2.3-]' 2>'equal version endpoints are earliest' == 1 } } : comparison : { : valid : $* <<EOI >>EOE == 1.2.3 >= 1.2.3 <= 1.2.3 > 1.2.3 < 1.2.3 >=1.2.3- <=1.2.3- >1.2.3- <1.2.3- EOI == 1.2.3 >= 1.2.3 <= 1.2.3 > 1.2.3 < 1.2.3 >= 1.2.3- <= 1.2.3- > 1.2.3- < 1.2.3- EOE : invalid : { $* <'>=' 2>'no version' == 1 : no-version : eq-earliest : $* <'==1.2.3-' 2>"invalid version: 'a' or 'b' expected in pre-release" == 1 : eq-stub : $* <'==0' 2>"invalid version: '.' expected after major version" == 1 : junk : $* <'>= 1.2.3-a.1.1.ads@' 2>'invalid version: junk after version' == 1 } } } : satisfaction : { test.options += -s : comparison : : Constraints have a single endpoint being present. : { : eq : { $* '1.2.3' '== 1.2.3' >y : eq $* '1.2.3' '<= 1.2.3' >y : le $* '1.2.3' '< 1.2.3' >n : lt $* '1.2.3' '>= 1.2.3' >y : ge $* '1.2.3' '> 1.2.3' >n : gt } : smaller-greater : { $* '1.2.3' '== 1.2.4' >n : eq $* '1.2.3' '<= 1.2.4' >y : le $* '1.2.3' '< 1.2.4' >y : lt $* '1.2.3' '>= 1.2.4' >n : ge $* '1.2.3' '> 1.2.4' >n : gt } : greater-smaller : { $* '1.2.4' '<= 1.2.3' >n : le $* '1.2.4' '< 1.2.3' >n : lt $* '1.2.4' '>= 1.2.3' >y : ge $* '1.2.4' '> 1.2.3' >y : gt } } : range : : Constraints have both endpoints being present. : { : left-out : { $* '1.2.3' '[1.2.4 1.2.5]' >n : closed $* '1.2.3' '(1.2.4 1.2.5]' >n : open } : left-endpoint : { $* '1.2.3' '[1.2.3 1.2.4]' >y : closed $* '1.2.3' '(1.2.3 1.2.4]' >n : open } : in : { $* '1.2.3' '[1.2.2 1.2.4]' >y : closed $* '1.2.3' '(1.2.2 1.2.4)' >y : open } : right-endpoint : { $* '1.2.3' '[1.2.2 1.2.3]' >y : closed $* '1.2.3' '[1.2.2 1.2.3)' >n : open } : right-out : { $* '1.2.3' '[1.2.1 1.2.2]' >n : closed $* '1.2.3' '[1.2.1 1.2.2)' >n : open } } }