mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 12:18:29 +01:00
Add failing test for case folding issue
This commit is contained in:
parent
19de58f2ab
commit
4d28255e8e
@ -159,3 +159,12 @@ benchmarks:
|
||||
- casa-client
|
||||
ghc-options:
|
||||
- -O2
|
||||
|
||||
tests:
|
||||
unit-tests:
|
||||
main: main.hs
|
||||
source-dirs: unit-tests
|
||||
dependencies:
|
||||
- stackage-server
|
||||
- hspec
|
||||
- pantry
|
||||
|
||||
@ -5,6 +5,10 @@ extra-deps:
|
||||
- classy-prelude-yesod-1.5.0
|
||||
- unliftio-core-0.1.2.0
|
||||
- yesod-gitrepo-0.3.0
|
||||
- hspec-2.11.1
|
||||
- hspec-core-2.11.1
|
||||
- hspec-discover-2.11.1
|
||||
- hspec-expectations-0.8.3
|
||||
|
||||
drop-packages:
|
||||
- Cabal
|
||||
|
||||
28
unit-tests/main.hs
Normal file
28
unit-tests/main.hs
Normal file
@ -0,0 +1,28 @@
|
||||
import Pantry (parseVersionThrowing, parsePackageNameThrowing)
|
||||
import Pantry.Internal.Stackage (VersionP(VersionP), PackageNameP(PackageNameP))
|
||||
import Stackage.Snapshot.Diff (SnapshotDiff, snapshotDiff, toDiffList)
|
||||
|
||||
import Test.Hspec (Spec, describe, hspec, it, shouldBe)
|
||||
|
||||
snapshotDiffLength :: SnapshotDiff -> Int
|
||||
snapshotDiffLength = length . toDiffList
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
booleanName <- PackageNameP <$> parsePackageNameThrowing "Boolean"
|
||||
booleanVer <- VersionP <$> parseVersionThrowing "0.2.4"
|
||||
bookkeepingName <- PackageNameP <$> parsePackageNameThrowing "bookkeeping"
|
||||
bookkeepingVer <- VersionP <$> parseVersionThrowing "0.4.0.1"
|
||||
|
||||
let
|
||||
boolean = (booleanName, booleanVer)
|
||||
bookkeeping = (bookkeepingName, bookkeepingVer)
|
||||
|
||||
hspec $
|
||||
describe "Packages with upper case characters" $
|
||||
describe "Removal of bookkeeping package is one change" $ do
|
||||
it "[Boolean, bookkeeping] -> [Boolean]" $
|
||||
snapshotDiffLength (snapshotDiff [boolean, bookkeeping] [boolean]) `shouldBe` 1
|
||||
|
||||
it "[bookkeeping, Boolean] -> [Boolean]" $
|
||||
snapshotDiffLength (snapshotDiff [bookkeeping, boolean] [boolean]) `shouldBe` 1
|
||||
Loading…
Reference in New Issue
Block a user