Skip to content

Commit

Permalink
Test versions with a dash in the prerelease tag
Browse files Browse the repository at this point in the history
Add tests to verify that versions with a dash in the prerelease tag,
e.g. 1.0.0-12-abc123 isn't converted to a range
  • Loading branch information
carolynvs committed Apr 2, 2018
1 parent adf96c4 commit 2a63d2a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestParseConstraint(t *testing.T) {
}

if !constraintEq(tc.c, c) {
t.Errorf("Incorrect version found on %s", tc.in)
t.Errorf("%q produced constraint %q, but expected %q", tc.in, c, tc.c)
}
}
}
Expand Down Expand Up @@ -292,6 +292,18 @@ func TestNewConstraint(t *testing.T) {
newV(1, 4, 0),
},
}, false},
{"1.1.0 - 12-abc123-foo", rangeConstraint{
min: newV(1,1,0),
max: Version{major: 12, minor: 0, patch: 0, pre: "abc123-foo"},
includeMin: true,
includeMax: true,
}, false},
{"^1.1.0-12-abc123", rangeConstraint{
min: Version{major: 1, minor: 1, patch: 0, pre: "12-abc123"},
max: newV(2, 0, 0),
includeMin: true,
includeMax: false,
}, false},
}

for _, tc := range tests {
Expand Down

0 comments on commit 2a63d2a

Please sign in to comment.