diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-03-24 13:20:22 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-03-24 13:20:22 +0100 |
| commit | 7c9c89005645f6811dfb562b333d2742c9e1d5e4 (patch) | |
| tree | c4427f51a395a41216ce4cafd79c70b1a9d45a99 /tests/SlackBuilder | |
| parent | 7e59a8460ddd465ee529b00b7ecb98d4b299abce (diff) | |
| download | slackbuilder-7c9c89005645f6811dfb562b333d2742c9e1d5e4.tar.gz | |
Extern tag matcher with digit and dot patterns
Diffstat (limited to 'tests/SlackBuilder')
| -rw-r--r-- | tests/SlackBuilder/LatestVersionCheckSpec.hs | 35 |
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 |
