Skip to content

Commit

Permalink
Add tests for version parsing and comparison logic
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell authored and Licenser committed Aug 12, 2010
1 parent fd8e6fb commit 6436cce
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/lein_search/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,24 @@
(:use [lein-search.core] :reload-all)
(:use [clojure.test]))

(deftest replace-me ;; FIXME: write
(is false))
(deftest version-parsing
(are [a b] (= a (split-version b))
[0 1 2 ""] "0.1.2"
[0 1 0 ""] "0.1"
[1 2 3 "SNAPSHOT"] "1.2.3-SNAPSHOT"
[1 2 0 "SNAPSHOT"] "1.2-SNAPSHOT"))

(deftest version-comparisons
(are [a b c] (= a (compare-versions b c))
1 "1.2" "1.1"
-1 "1.1" "1.2"
0 "1.1" "1.1"
1 "0.1.1" "0.1"
-1 "0.1" "0.1.1"
0 "0.1.1" "0.1.1"
;; ? "0.1.0" "0.1"
;; 1 "1.2" "1.2-RC2"
0 "1.1-RC" "1.1-RC"
0 "0.2-SNAPSHOT" "0.2-SNAPSHOT"
1 "0.1" "0.1-SNAPSHOT"
-1 "0.1-SNAPSHOT" "0.1"))

0 comments on commit 6436cce

Please sign in to comment.