babashka/test-resources/lib_tests/version_clj/split_test.cljc
Lee Read 5d9027fe0a
Added lib tests for version-clj (#569)
The version-clj project uses `.cljx` so I hand-transcribed them to `.cljc`.

Tests are from from version-clj v1.0.2:
https://github.com/xsc/version-clj/tree/clojars-0.1.2

Added `version-clj.via-use-test` to verify loading version-clj via `use`.

Verification via: `./script/run_lib_tests`, I observed version-clj tests:
1. failing for `bb` native v0.2.0
2. passing for `./bb` native built from master
3. passing for `lein bb` from master

This should be the final change that closes #565.
2020-09-09 23:03:15 +02:00

22 lines
774 B
Clojure

(ns version-clj.split-test
(:require [clojure.test :refer [deftest are is]]
[version-clj.split :refer [version->seq]]))
(deftest t-split
(are [version v] (= (version->seq version) v)
"1.0.0" [[1 0 0]]
"1.0" [[1 0]]
"1" [[1]]
"1a" [[1] ["a"]]
"1-a" [[1] ["a"]]
"1.0.1-SNAPSHOT" [[1 0 1] ["snapshot"]]
"1.0.1-alpha2" [[1 0 1] ["alpha" 2]]
"11.2.0.3.0" [[11 2 0 3 0]]
"1.0-1-0.2-RC" [[1 [0 1 0] 2] ["rc"]]))
(deftest t-split-with-large-number
(is (= (version->seq "0.0.1-20141002100138")
[[0 0 1] [20141002100138]]))
#?(:clj
(let [v (str Long/MAX_VALUE "12345")]
(is (= (version->seq v) [[(bigint v)]])))))