Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range issue perhaps? #42

Open
twoofy opened this issue Jul 13, 2018 · 1 comment
Open

range issue perhaps? #42

twoofy opened this issue Jul 13, 2018 · 1 comment

Comments

@twoofy
Copy link

twoofy commented Jul 13, 2018

I was trying to figure out what might be causing some unexpected behavior in this package. To be honest, I'm not sure if this is something I'm doing wrong or not.

I added some extra code to range_test.go, which I think shows the issue:

		{">1.2.2 <1.2.4", []tv{
			{"1.2.1", false},
			{"1.2.1-pl1", false},
			{"1.2.2", false},
			{"1.2.2-pl1", false},
			{"1.2.3", true},
			{"1.2.3-pl1", true},
			{"1.2.4", false},
			{"1.2.4-pl1", false},
		}},
		{">=1.2.2 <1.2.4", []tv{
			{"1.2.1", false},
			{"1.2.1-pl1", false},
			{"1.2.2", true},
			{"1.2.2-pl1", true},
			{"1.2.3", true},
			{"1.2.3-pl1", true},
			{"1.2.4", false},
			{"1.2.4-pl1", false},
		}},

The issue is that versions with -pl1 seem to return different results then those without.

The output of the above is:

--- FAIL: TestParseRange (0.00s)
	range_test.go:514: Invalid for case ">1.2.2 <1.2.4" matching "1.2.4-pl1": Expected false, got: true
	range_test.go:514: Invalid for case ">=1.2.2 <1.2.4" matching "1.2.2-pl1": Expected true, got: false
	range_test.go:514: Invalid for case ">=1.2.2 <1.2.4" matching "1.2.4-pl1": Expected false, got: true
FAIL
exit status 1
FAIL	github.com/blang/semver	0.007s

Am I doing something wrong here?

  • Greg
@blang
Copy link
Owner

blang commented Dec 8, 2018

1.2.4-pl1 < 1.2.4 is true according to spec Section 11: https://semver.org/#spec-item-11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants