Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests for version parsing and comparison logic

  • Loading branch information...
commit 6436cce467feb5d916c89b690c98b724a8ebc9da 1 parent fd8e6fb
@purcell purcell authored committed
Showing with 21 additions and 2 deletions.
  1. +21 −2 test/lein_search/core_test.clj
View
23 test/lein_search/core_test.clj
@@ -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"))
Please sign in to comment.
Something went wrong with that request. Please try again.