Skip to content

Commit 04f2887

Browse files
committed
---
yaml --- r: 102139 b: refs/heads/master c: b0a495f h: refs/heads/master i: 102137: a6e01c1 102135: 70906ae v: v3
1 parent 5446e53 commit 04f2887

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4bc7672335bf29f28ef88fedaa4b1abaf370f691
2+
refs/heads/master: b0a495f0ae70ebbaa0f74ae21c3a1e94a882c6b7
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/mk/tests.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ endif
171171
# Main test targets
172172
######################################################################
173173

174-
check: cleantmptestlogs cleantestlibs tidy check-notidy
175-
176-
check-notidy: cleantmptestlogs cleantestlibs all check-stage2
174+
check: cleantestlibs cleantmptestlogs tidy all check-stage2
177175
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
178176

179177
check-lite: cleantestlibs cleantmptestlogs \

trunk/src/libsemver/lib.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl fmt::Show for Identifier {
7272

7373

7474
/// Represents a version number conforming to the semantic versioning scheme.
75-
#[deriving(Clone, Eq)]
75+
#[deriving(Clone)]
7676
pub struct Version {
7777
/// The major version, to be incremented on incompatible changes.
7878
major: uint,
@@ -110,6 +110,19 @@ impl fmt::Show for Version {
110110
}
111111
}
112112

113+
impl cmp::Eq for Version {
114+
#[inline]
115+
fn eq(&self, other: &Version) -> bool {
116+
// We should ignore build metadata here, otherwise versions v1 and v2
117+
// can exist such that !(v1 < v2) && !(v1 > v2) && v1 != v2, which
118+
// violate strict total ordering rules.
119+
self.major == other.major &&
120+
self.minor == other.minor &&
121+
self.patch == other.patch &&
122+
self.pre == other.pre
123+
}
124+
}
125+
113126
impl cmp::Ord for Version {
114127
#[inline]
115128
fn lt(&self, other: &Version) -> bool {
@@ -347,6 +360,7 @@ fn test_eq() {
347360
assert_eq!(parse("1.2.3-alpha1"), parse("1.2.3-alpha1"));
348361
assert_eq!(parse("1.2.3+build.42"), parse("1.2.3+build.42"));
349362
assert_eq!(parse("1.2.3-alpha1+42"), parse("1.2.3-alpha1+42"));
363+
assert_eq!(parse("1.2.3+23"), parse("1.2.3+42"));
350364
}
351365
352366
#[test]
@@ -355,7 +369,6 @@ fn test_ne() {
355369
assert!(parse("0.0.0") != parse("0.1.0"));
356370
assert!(parse("0.0.0") != parse("1.0.0"));
357371
assert!(parse("1.2.3-alpha") != parse("1.2.3-beta"));
358-
assert!(parse("1.2.3+23") != parse("1.2.3+42"));
359372
}
360373
361374
#[test]
@@ -376,11 +389,11 @@ fn test_to_str() {
376389
377390
#[test]
378391
fn test_lt() {
379-
assert!(parse("0.0.0") < parse("1.2.3-alpha2"));
380-
assert!(parse("1.0.0") < parse("1.2.3-alpha2"));
381-
assert!(parse("1.2.0") < parse("1.2.3-alpha2"));
382-
assert!(parse("1.2.3-alpha1") < parse("1.2.3"));
383-
assert!(parse("1.2.3-alpha1") < parse("1.2.3-alpha2"));
392+
assert!(parse("0.0.0") < parse("1.2.3-alpha2"));
393+
assert!(parse("1.0.0") < parse("1.2.3-alpha2"));
394+
assert!(parse("1.2.0") < parse("1.2.3-alpha2"));
395+
assert!(parse("1.2.3-alpha1") < parse("1.2.3"));
396+
assert!(parse("1.2.3-alpha1") < parse("1.2.3-alpha2"));
384397
assert!(!(parse("1.2.3-alpha2") < parse("1.2.3-alpha2")));
385398
assert!(!(parse("1.2.3+23") < parse("1.2.3+42")));
386399
}
@@ -397,11 +410,11 @@ fn test_le() {
397410
398411
#[test]
399412
fn test_gt() {
400-
assert!(parse("1.2.3-alpha2") > parse("0.0.0"));
401-
assert!(parse("1.2.3-alpha2") > parse("1.0.0"));
402-
assert!(parse("1.2.3-alpha2") > parse("1.2.0"));
403-
assert!(parse("1.2.3-alpha2") > parse("1.2.3-alpha1"));
404-
assert!(parse("1.2.3") > parse("1.2.3-alpha2"));
413+
assert!(parse("1.2.3-alpha2") > parse("0.0.0"));
414+
assert!(parse("1.2.3-alpha2") > parse("1.0.0"));
415+
assert!(parse("1.2.3-alpha2") > parse("1.2.0"));
416+
assert!(parse("1.2.3-alpha2") > parse("1.2.3-alpha1"));
417+
assert!(parse("1.2.3") > parse("1.2.3-alpha2"));
405418
assert!(!(parse("1.2.3-alpha2") > parse("1.2.3-alpha2")));
406419
assert!(!(parse("1.2.3+23") > parse("1.2.3+42")));
407420
}
@@ -418,7 +431,6 @@ fn test_ge() {
418431
419432
#[test]
420433
fn test_spec_order() {
421-
422434
let vs = ["1.0.0-alpha",
423435
"1.0.0-alpha.1",
424436
"1.0.0-alpha.beta",

0 commit comments

Comments
 (0)