summaryrefslogtreecommitdiff
path: root/tests/SlackBuilder/LatestVersionCheckSpec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/SlackBuilder/LatestVersionCheckSpec.hs')
-rw-r--r--tests/SlackBuilder/LatestVersionCheckSpec.hs35
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/SlackBuilder/LatestVersionCheckSpec.hs b/tests/SlackBuilder/LatestVersionCheckSpec.hs
index 9abce99..bc4a0f2 100644
--- a/tests/SlackBuilder/LatestVersionCheckSpec.hs
+++ b/tests/SlackBuilder/LatestVersionCheckSpec.hs
@@ -11,30 +11,33 @@ import Test.Hspec (Spec, describe, it, shouldBe)
spec :: Spec
spec = do
- describe "stableTagTransform" $ do
- it "excludes tags with +" $
- let given = "v2.6.0+unreleased"
- actual = stableTagTransform given
- in actual `shouldBe` Nothing
-
- it "recognizes a stable version" $
- let given = "v2.6.0"
- actual = stableTagTransform given
- expected = Just "2.6.0"
- in actual `shouldBe` expected
-
describe "match" $ do
- it "matches an exact tag prefixed with v" $
+ it "matches an exact tag prefixed with v" $
let expected = Just "2.6.0"
actual = match "(v)2.6.0" "v2.6.0"
in actual `shouldBe` expected
- it "matches a glob pattern prefixed with v" $
+ it "matches a glob pattern prefixed with v" $
let expected = Just "2.6.0"
actual = match "(v)*" "v2.6.0"
in actual `shouldBe` expected
- it "ignores suffix after wildcard" $
+ it "matches digits" $
+ let expected = Just "2.6.0"
+ actual = match "(v)2.6.\\d" "v2.6.0"
+ in actual `shouldBe` expected
+
+ it "matches digits and dot" $
let expected = Just "2.6.0"
- actual = match "(v)*(-rc1)" "v2.6.0-rc1"
+ actual = match "(v)\\." "v2.6.0"
+ in actual `shouldBe` expected
+
+ it "rejects unexpected suffix" $
+ let expected = Nothing
+ actual = match "(v)\\." "v2.6.0-rc1"
+ in actual `shouldBe` expected
+
+ it "rejects remaining umatched characters" $
+ let expected = Nothing
+ actual = match "2.6.0-rc1" "2.6.0"
in actual `shouldBe` expected