Browse Source

Drop build metadata as well

tags/v0.10.0
Alex Williams 3 years ago
parent
commit
3650793b23
Signed by: aw GPG Key ID: 19EE4AAA361A7E2C
3 changed files with 4 additions and 2 deletions
  1. +2
    -1
      README.md
  2. +1
    -1
      semver.l
  3. +1
    -0
      test/test_semver.l

+ 2
- 1
README.md View File

@@ -5,7 +5,8 @@
[SemVer 2.0.0](http://semver.org) library for PicoLisp

* Validates and compares **Major.Minor.Patch** versions (ex: `"1.0.0"`)
* Drops pre-release, build, metadata, and special extensions (ex: `1.1.0-alpha.1 -> 1.1.0`)
* Drops pre-release extensions (ex: `1.1.0-alpha.1 -> 1.1.0`)
* Drops build metadata extensions (ex: `2.2.0+buildmetadata -> 2.0.0`)
* Drops versions prefixed with `v` or `v.` (ex: `v3.3.0 -> 3.3.0`)
* Invalidates incorrectly formatted versions (ex: `"1.invalid.0" -> NIL`)



+ 1
- 1
semver.l View File

@@ -50,7 +50,7 @@
(glue "." L) ]

[de semver-internal-to-version (S)
(clip (split (chop S) '. '- 'v)) ]
(clip (split (chop S) '. '- 'v '+)) ]

### public



+ 1
- 0
test/test_semver.l View File

@@ -44,6 +44,7 @@
'(assert-t (semver-compare "1.4.3" "1.4.2") "Is 1.4.4 > 1.4.2 ?")
'(assert-t (semver-compare "1.5.2" "1.4.2") "Is 1.5.2 > 1.4.2 ?")
'(assert-t (semver-compare "2.4.2" "1.4.2") "Is 2.4.2 > 1.4.2 ?")
'(assert-equal 0 (semver-compare "v3.3.0+buildmetadata" "3.3.0") "Is v3.3.0+buildmetadata = 3.3.0 ?")
'(assert-equal 0 (semver-compare "v3.3.0" "3.3.0") "Is v3.3.0 = 3.3.0 ?")
'(assert-equal 0 (semver-compare "v.3.3.0" "3.3.0") "Is v.3.3.0 = 3.3.0 ?")
'(assert-equal 0 (semver-compare "1.4.2" "1.4.2") "Is 1.4.2 = 1.4.2 ?")


Loading…
Cancel
Save