zafarkhaja / jsemver

Java implementation of the SemVer Specification
MIT License
429 stars 82 forks source link

Tilde expression doesn't resolve correctly #25

Closed atcol closed 8 years ago

atcol commented 8 years ago

My understanding is that the following expression should print true (in Groovy for brevity):

import com.github.zafarkhaja.semver.Version
println Version.valueOf("1.3.0").satisfies("~1.2.3");

but it in fact prints false.

Can you clarify if this is an issue or not? Is there a workaround if so?

zafarkhaja commented 8 years ago

The rules of the tilde ranges were copied from those of the node-semver and if you refer to its documentation you will find the exact example you're asking about

~1.2.3 := >=1.2.3 <1.(2+1).0 := >=1.2.3 <1.3.0

which states that 1.3.0 is not included, hence doesn't satisfy ~1.2.3. So in this regard jsemver's behavior is correct.

atcol commented 8 years ago

That's right. I'm sorry, misread the node semver myself. Thank you!