Extern tag matcher with digit and dot patterns
This commit is contained in:
@ -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)*(-rc1)" "v2.6.0-rc1"
|
||||
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)\\." "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
|
||||
|
Reference in New Issue
Block a user