Skip to content

Commit a0bab8b

Browse files
committed
Merge branch 'ghc-9.12'
2 parents 3806e03 + df654ae commit a0bab8b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

test/Test.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Main ( main ) where
88

99
import Data.Either (fromRight, isLeft)
1010
import Data.List.NonEmpty (NonEmpty(..))
11+
import qualified Data.List.NonEmpty as NonEmpty
1112
import qualified Data.Text as T
1213
import Data.Versions
1314
import Data.Void (Void)
@@ -39,7 +40,7 @@ messes :: [T.Text]
3940
messes = [ "10.2+0.93+1-1", "003.03-3", "002.000-7", "20.26.1_0-2", "1.6.0a+2014+m872b87e73dfb-1"
4041
, "1.3.00.16851-1", "5.2.458699.0906-1", "12.0.0-3ubuntu1~20.04.5" ]
4142

42-
messComps :: [T.Text]
43+
messComps :: NonEmpty T.Text
4344
messComps = [ "10.2+0.93+1-1", "10.2+0.93+1-2", "10.2+0.93+2-1"
4445
, "10.2+0.94+1-1", "10.3+0.93+1-1", "11.2+0.93+1-1", "12"
4546
]
@@ -67,7 +68,7 @@ goodSemVs = [ "0.1.0", "1.2.3", "1.2.3-1", "1.2.3-alpha", "1.2.3-alpha.2"
6768
]
6869

6970
-- | The exact example from `http://semver.org`
70-
semverOrd :: [T.Text]
71+
semverOrd :: NonEmpty T.Text
7172
semverOrd = [ "1.0.0-alpha", "1.0.0-alpha.1", "1.0.0-alpha.beta"
7273
, "1.0.0-beta", "1.0.0-beta.2", "1.0.0-beta.11", "1.0.0-rc.1"
7374
, "1.0.0"
@@ -78,10 +79,10 @@ semverOrd = [ "1.0.0-alpha", "1.0.0-alpha.1", "1.0.0-alpha.beta"
7879
-- make this necessary, meaning `cabal` can't be simplified to ignore it.
7980
-- Logically, these are the same package, but for those 5 packages, they
8081
-- aren't.
81-
cabalOrd :: [T.Text]
82+
cabalOrd :: NonEmpty T.Text
8283
cabalOrd = [ "0", "0.2", "0.2.0", "0.2.0.0" ]
8384

84-
versionOrd :: [T.Text]
85+
versionOrd :: NonEmpty T.Text
8586
versionOrd = [ "0.9.9.9", "1.0.0.0", "1.0.0.1", "2" ]
8687

8788
suite :: TestTree
@@ -95,7 +96,7 @@ suite = testGroup "Tests"
9596
testCase "1.2.3-alpha.2 == 1.2.3-alpha.2+a1b2c3.1"
9697
(assertBool "Equality test of two complicated SemVers failed"
9798
$ semver "1.2.3-alpha.2" == semver "1.2.3-alpha.2+a1b2c3.1") :
98-
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp semver a b) semverOrd (tail semverOrd)
99+
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp semver a b) (NonEmpty.toList semverOrd) (NonEmpty.tail semverOrd)
99100
, testGroup "Whitespace Handling"
100101
[ testCase "1.2.3-1[ ]" $ parse semver' "semver whitespace" "1.2.3-1 " @?= Right (SemVer 1 2 3 (Just . Release $ Numeric 1 :| []) Nothing)
101102
]
@@ -105,11 +106,11 @@ suite = testGroup "Tests"
105106
]
106107
, testGroup "(Haskell) PVP"
107108
[ testGroup "Good PVPs" $
108-
map (\s -> testCase (T.unpack s) $ isomorphPVP s) cabalOrd
109+
map (\s -> testCase (T.unpack s) $ isomorphPVP s) (NonEmpty.toList cabalOrd)
109110
, testGroup "Bad PVP" $
110111
map (\s -> testCase (T.unpack s) $ assertBool "A bad PVP parsed" $ isLeft $ pvp s) badPVP
111112
, testGroup "Comparisons" $
112-
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp pvp a b) cabalOrd (tail cabalOrd)
113+
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp pvp a b) (NonEmpty.toList cabalOrd) (NonEmpty.tail cabalOrd)
113114
]
114115
, testGroup "(General) Versions"
115116
[ testGroup "Good Versions" $
@@ -123,15 +124,15 @@ suite = testGroup "Tests"
123124
testCase "1.1 < 1:1.0" (comp version "1.1" "1:1.0") :
124125
testCase "1.1 < 1:1.1" (comp version "1.1" "1:1.1") :
125126
map (\(a,b) -> testCase (T.unpack $ a <> " < " <> b) $ comp version a b)
126-
(zip cabalOrd (tail cabalOrd) <> zip versionOrd (tail versionOrd))
127+
(zip (NonEmpty.toList cabalOrd) (NonEmpty.tail cabalOrd) <> zip (NonEmpty.toList versionOrd) (NonEmpty.tail versionOrd))
127128
]
128129
, testGroup "(Complex) Mess"
129130
[ testGroup "Good Versions" $
130131
map (\s -> testCase (T.unpack s) $ isomorphM s) messes
131132
, testGroup "Bad Versions (shouldn't parse)" $
132133
map (\s -> testCase (T.unpack s) $ assertBool "A bad version parsed" $ isLeft $ mess s) badVers
133134
, testGroup "Comparisons" $
134-
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp mess a b) messComps (tail messComps)
135+
zipWith (\a b -> testCase (T.unpack $ a <> " < " <> b) $ comp mess a b) (NonEmpty.toList messComps) (NonEmpty.tail messComps)
135136
, testGroup "SemVer-like Value Extraction"
136137
[ testCase "messMajor" $
137138
(hush (mess "1.6.0a+2014+m872b87e73dfb-1") >>= messMajor) @?= Just 1

versions.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ common commons
4040
-Wincomplete-uni-patterns
4141

4242
build-depends:
43-
, base >=4.10 && <4.21
43+
, base >=4.10 && <4.22
4444
, megaparsec >=7
4545
, text ^>=1.2 || >= 2.0 && < 2.2
4646
, template-haskell >= 2.15

0 commit comments

Comments
 (0)