diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 7b3d2a5..eb62aa0 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -123,7 +123,7 @@ jobs: echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" - echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" ; else echo "ARG_TESTS=--disable-tests" >> "$GITHUB_ENV" ; fi echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" @@ -230,7 +230,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - name: tests run: | - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct ; fi - name: cabal check run: | cd ${PKGDIR_cassava} || false diff --git a/CHANGES.md b/CHANGES.md index f80f6f7..ce33f3a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,9 @@ ## Version 0.5.3.2 + * Proper exception on hanging doublequote ([PR #222](https://github.com/haskell-hvr/cassava/pull/222)). * Allow latest `hashable`. - * Tested with GHC 8.0 - 9.10.1. + * Build tested with GHC 8.0 - 9.10.1. + * Functionality tested with GHC 8.4 - 9.10.1. ## Version 0.5.3.1 diff --git a/cabal.haskell-ci b/cabal.haskell-ci index b00407e..e486d54 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,5 +1,7 @@ branches: master +tests: >= 8.4 + -- constraint-set containers-0.7 -- ghc: >=8.2 -- constraints: containers ^>=0.7 diff --git a/cassava.cabal b/cassava.cabal index 66953c6..85ea009 100644 --- a/cassava.cabal +++ b/cassava.cabal @@ -136,7 +136,7 @@ Test-suite unit-tests Main-is: UnitTests.hs -- dependencies with version constraints inherited via lib:cassava Build-depends: attoparsec - , base + , base >= 4.11 && < 5 , bytestring , cassava , hashable @@ -158,12 +158,10 @@ Test-suite unit-tests -Wall -- https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Recommendationsforforward-compatibility -Wcompat + -Wcpp-undef -Wnoncanonical-monad-instances if impl(ghc >= 8.8) ghc-options: -Wno-star-is-type else ghc-options: -Wnoncanonical-monadfail-instances - - if impl(ghc >= 8.2) - ghc-options: -Wcpp-undef diff --git a/tests/UnitTests.hs b/tests/UnitTests.hs index e42f1e2..eae2c05 100644 --- a/tests/UnitTests.hs +++ b/tests/UnitTests.hs @@ -167,7 +167,11 @@ positionalTests = [ testGroup "decode" $ map streamingDecodeTest decodeTests , testGroup "decodeWith" $ map streamingDecodeWithTest decodeWithTests ] - , testGroup "escaped" escapedTests + , testGroup "failing" + [ testCase "escapedMalformed0" $ + "baz,\"" `decodeFailsWith` "Failed reading: trailing double quote" + ] + ] where rfc4180Input = BL8.pack $ @@ -188,6 +192,10 @@ positionalTests = [["a", "b", "c"], ["d", "e", "f"]]) , ("leadingSpace", " a, b, c\n", [[" a", " b", " c"]]) , ("rfc4180", rfc4180Input, rfc4180Output) + , ("escapedDoubleQuotes" + , "\"x,y\",z\nbaz,\"bar\nfoo,\"" + , [["x,y", "z"], ["baz", "bar\nfoo,"]] + ) ] decodeWithTests = [ ("tab-delim", defDec { decDelimiter = 9 }, "1\t2", [["1", "2"]]) @@ -212,15 +220,6 @@ positionalTests = defEncAllEnq = defaultEncodeOptions { encQuoting = QuoteAll } defDec = defaultDecodeOptions - escapedTests = [ - testCase "escaped" $ - "\"x,y\",z\nbaz,\"bar\nfoo,\"" `decodesAs` [["x,y", "z"], ["baz", "bar\nfoo,"]], - testCase "escapedMalformed1" $ - "\"x,\"y" `decodeFailsWith` "Failed reading: satisfy", - testCase "escapedMalformed0" $ - "baz,\"" `decodeFailsWith` "Failed reading: trailing double quote" - ] - nameBasedTests :: [TF.Test] nameBasedTests = [ testGroup "encode" $ map encodeTest