git.iko.soy/typeable/hjsonpointer
on 53833ce help sign in
6 files changed+62−78
since splitsnapshots
unifiedsplit
.travis.yml+49−55 changelog.md−9 hjsonpointer.cabal+6−4 src/JSONPointer.hs+5−1 stack.yaml+1−1 test/Unit.hs+1−8
.travis.yml+49−55
@@ -1,11 +1,9 @@
11# This Travis job script has been generated by a script via
22#
3−# runghc make_travis_yml_2.hs 'hjsonpointer.cabal'
3+# make_travis_yml_2.hs 'hjsonpointer.cabal'
44#
55# For more information, see https://github.com/hvr/multi-ghc-travis
6−
7−# NOTE: After generating comment out `cabal check`, it requires a description field.
8−
6+#
97language: c
108sudo: false
119
@@ -26,10 +24,11 @@ before_cache:
2624 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
2725 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
2826
29− - rm -rfv $HOME/.cabal/packages/head.hackage
30−
3127matrix:
3228 include:
29+ - compiler: "ghc-7.10.3"
30+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
31+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
3332 - compiler: "ghc-8.0.2"
3433 # env: TEST=--disable-tests BENCH=--disable-benchmarks
3534 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
@@ -41,64 +40,59 @@ matrix:
4140 addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
4241
4342before_install:
44− - HC=${CC}
45− - HCPKG=${HC/ghc/ghc-pkg}
46− - unset CC
47− - ROOTDIR=$(pwd)
48− - mkdir -p $HOME/.local/bin
49− - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
50− - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
51− - echo $HCNUMVER
43+ - HC=${CC}
44+ - HCPKG=${HC/ghc/ghc-pkg}
45+ - unset CC
46+ - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
47+ - PKGNAME='hjsonpointer'
5248
5349install:
54− - cabal --version
55− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
56− - BENCH=${BENCH---enable-benchmarks}
57− - TEST=${TEST---enable-tests}
58− - HADDOCK=${HADDOCK-true}
59− - INSTALLED=${INSTALLED-true}
60− - GHCHEAD=${GHCHEAD-false}
61− - travis_retry cabal update -v
62− - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
63− - rm -fv cabal.project cabal.project.local
64− - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
65− - "printf 'packages: \".\"\\n' > cabal.project"
66− - cat cabal.project
67− - if [ -f "./configure.ac" ]; then
68− (cd "." && autoreconf -i);
69− fi
70− - rm -f cabal.project.freeze
71− - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
72− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
73− - rm -rf .ghc.environment.* "."/dist
74− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
50+ - cabal --version
51+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
52+ - BENCH=${BENCH---enable-benchmarks}
53+ - TEST=${TEST---enable-tests}
54+ - HADDOCK=${HADDOCK-true}
55+ - INSTALLED=${INSTALLED-true}
56+ - travis_retry cabal update -v
57+ - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
58+ - rm -fv cabal.project.local
59+ - "echo 'packages: .' > cabal.project"
60+ - rm -f cabal.project.freeze
61+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
62+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
7563
7664# Here starts the actual work to be performed for the package under test;
7765# any command which exits with a non-zero exit code causes the build to fail.
7866script:
79− # test that source-distributions can be generated
80− - (cd "." && cabal sdist)
81− - mv "."/dist/hjsonpointer-*.tar.gz ${DISTDIR}/
82− - cd ${DISTDIR} || false
83− - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
84− - "printf 'packages: hjsonpointer-*/*.cabal\\n' > cabal.project"
85− - cat cabal.project
86− # this builds all libraries and executables (without tests/benchmarks)
87− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
88−
89− # Build with installed constraints for packages in global-db
90− - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
67+ - if [ -f configure.ac ]; then autoreconf -i; fi
68+ - rm -rf .ghc.environment.* dist/
69+ - cabal sdist # test that a source-distribution can be generated
70+ - cd dist/
71+ - SRCTAR=(${PKGNAME}-*.tar.gz)
72+ - SRC_BASENAME="${SRCTAR/%.tar.gz}"
73+ - tar -xvf "./$SRC_BASENAME.tar.gz"
74+ - cd "$SRC_BASENAME/"
75+## from here on, CWD is inside the extracted source-tarball
76+ - rm -fv cabal.project.local
77+ - "echo 'packages: .' > cabal.project"
78+ # this builds all libraries and executables (without tests/benchmarks)
79+ - rm -f cabal.project.freeze
80+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
81+ # this builds all libraries and executables (including tests/benchmarks)
82+ # - rm -rf ./dist-newstyle
9183
92− # build & run tests, build benchmarks
93− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
94− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
84+ # Build with installed constraints for packages in global-db
85+ - if $INSTALLED; then
86+ echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh;
87+ else echo "Not building with installed constraints"; fi
9588
96− # cabal check
97− # - (cd hjsonpointer-* && cabal check)
89+ # build & run tests, build benchmarks
90+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
91+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
9892
99− # haddock
100− - rm -rf ./dist-newstyle
101− - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
93+ # haddock
94+ - rm -rf ./dist-newstyle
95+ - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
10296
10397# REGENDATA ["hjsonpointer.cabal"]
10498# EOF
changelog.md−9
@@ -1,12 +1,3 @@
1−# 1.5.0
2−
3−+ Drop QuickCheck dependency (thanks @mmhat !).
4−
5−# 1.4.0
6−
7−+ Enable GHC 8.4 (thanks @4e6 !).
8−+ Drop GHC 7.10.
9−
101# 1.3.0
112
123+ Test with GHC 8.2. Drop GHC 7.8.
hjsonpointer.cabal+6−4
@@ -1,5 +1,5 @@
11name: hjsonpointer
2−version: 1.5.0
2+version: 1.3.0
33synopsis: JSON Pointer library
44homepage: https://github.com/seagreen/hjsonpointer
55license: MIT
@@ -10,7 +10,7 @@ category: Data
1010build-type: Simple
1111cabal-version: >=1.10
1212-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:
13−Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
13+Tested-With: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
1414extra-source-files:
1515 changelog.md
1616 README.md
@@ -24,10 +24,13 @@ library
2424 exposed-modules:
2525 JSONPointer
2626 build-depends:
27− base >= 4.9 && < 5
27+ base >= 4.6 && < 4.12
2828 , aeson >= 0.7
2929 , hashable >= 1.2
30+ , QuickCheck >= 2.8
3031 , unordered-containers >= 0.2
32+ , semigroups >= 0.18
33+ -- ^ for GHCs < 8
3134 , text >= 1.2
3235 , vector >= 0.10
3336
@@ -42,7 +45,6 @@ test-suite unit
4245 OverloadedStrings
4346 ghc-options:
4447 -Wall
45− -fno-warn-orphans
4648 other-modules: Example
4749 build-depends:
4850 aeson
src/JSONPointer.hs+5−1
@@ -13,6 +13,7 @@ import Data.Text (Text)
1313import qualified Data.Text as T
1414import qualified Data.Vector as V
1515import GHC.Generics (Generic)
16+import Test.QuickCheck
1617import Text.Read (readMaybe)
1718
1819--------------------------------------------------
@@ -36,7 +37,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
3637
3738newtype Pointer
3839 = Pointer { _unPointer :: [Token] }
39− deriving (Eq, Show, Semigroup, Monoid, Generic)
40+ deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary)
4041
4142instance HA.Hashable Pointer
4243
@@ -62,6 +63,9 @@ newtype Token
6263
6364instance HA.Hashable Token
6465
66+instance Arbitrary Token where
67+ arbitrary = Token . T.pack <$> arbitrary
68+
6569-- | This escapes @"/"@ (because it's the token separator character).
6670--
6771-- It also escapes @"~"@ (because it's the escape character).
stack.yaml+1−1
@@ -1,2 +1,2 @@
1−resolver: lts-12.10
1+resolver: nightly-2017-09-18
22pvp-bounds: upper-revision
test/Unit.hs+1−8
@@ -1,5 +1,3 @@
1−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2−{-# LANGUAGE StandaloneDeriving #-}
31
42module Main where
53
@@ -15,15 +13,10 @@ import qualified JSONPointer as JP
1513import Network.HTTP.Types.URI (urlDecode)
1614
1715import Test.Hspec
18−import Test.QuickCheck (Arbitrary(..), property)
16+import Test.QuickCheck (property)
1917
2018import qualified Example
2119
22−deriving instance Arbitrary JP.Pointer
23−
24−instance Arbitrary JP.Token where
25− arbitrary = JP.Token . T.pack <$> arbitrary
26−
2720main :: IO ()
2821main = hspec $ do
2922 describe "example" $ do