dhall-json 1.2.2 → 1.2.3
raw patch · 6 files changed
+99/−10 lines, 6 filesdep +tastydep +tasty-hunitdep ~aesondep ~basedep ~dhallPVP ok
version bump matches the API change (PVP)
Dependencies added: tasty, tasty-hunit
Dependency ranges changed: aeson, base, dhall, text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- dhall-json.cabal +25/−9
- src/Dhall/JSON.hs +1/−1
- tasty/Main.hs +61/−0
- tasty/data/issue48.dhall +1/−0
- tasty/data/issue48.json +5/−0
CHANGELOG.md view
@@ -1,3 +1,9 @@+1.2.3++* Correctly handle nested association lists+* Increase upper bound on `dhall` dependency+* Increase upper bound on `yaml` dependency+ 1.2.2 * Increase upper bound on `dhall` dependency
dhall-json.cabal view
@@ -1,5 +1,5 @@ Name: dhall-json-Version: 1.2.2+Version: 1.2.3 Cabal-Version: >=1.8.0.2 Build-Type: Simple Tested-With: GHC == 7.10.2, GHC == 8.0.1@@ -22,7 +22,10 @@ The "Dhall.JSON" module also contains instructions for how to use this package Category: Compiler-Extra-Source-Files: CHANGELOG.md+Extra-Source-Files:+ CHANGELOG.md+ tasty/data/*.dhall+ tasty/data/*.json Source-Repository head Type: git Location: https://github.com/dhall-lang/dhall-json@@ -32,7 +35,7 @@ Build-Depends: base >= 4.8.0.0 && < 5 , aeson >= 1.0.0.0 && < 1.5 ,- dhall >= 1.15.0 && < 1.17,+ dhall >= 1.15.0 && < 1.18, insert-ordered-containers < 1.14, optparse-applicative >= 0.14.0.0 && < 0.15, text >= 0.11.1.0 && < 1.3 ,@@ -58,11 +61,24 @@ Hs-Source-Dirs: dhall-to-yaml Main-Is: Main.hs Build-Depends:- base ,- bytestring < 0.11,- dhall ,- dhall-json ,- optparse-applicative ,- yaml >= 0.5.0 && < 0.10,+ base ,+ bytestring < 0.11,+ dhall ,+ dhall-json ,+ optparse-applicative ,+ yaml >= 0.5.0 && < 0.11, text GHC-Options: -Wall++Test-Suite tasty+ Type: exitcode-stdio-1.0+ Hs-Source-Dirs: tasty+ Main-Is: Main.hs+ Build-Depends:+ base,+ aeson ,+ dhall ,+ dhall-json ,+ tasty < 1.2,+ text ,+ tasty-hunit >= 0.2
src/Dhall/JSON.hs view
@@ -512,7 +512,7 @@ Dhall.Core.ListLit a b -> case transform of- Just c -> c+ Just c -> loop c Nothing -> Dhall.Core.ListLit a' b' where elements = Data.Foldable.toList b
+ tasty/Main.hs view
@@ -0,0 +1,61 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}++module Main where++import Dhall.JSON (Conversion(..))+import Test.Tasty (TestTree)++import qualified Control.Exception+import qualified Data.Aeson+import qualified Data.Text.IO+import qualified Dhall.Import+import qualified Dhall.JSON+import qualified Dhall.Parser+import qualified Test.Tasty+import qualified Test.Tasty.HUnit++main :: IO ()+main = Test.Tasty.defaultMain testTree++testTree :: TestTree+testTree =+ Test.Tasty.testGroup "dhall-json"+ [ issue48+ ]++issue48 :: TestTree+issue48 = Test.Tasty.HUnit.testCase "Issue #48" assertion+ where+ assertion = do+ let file = "./tasty/data/issue48.dhall"++ code <- Data.Text.IO.readFile file++ parsedExpression <- case Dhall.Parser.exprFromText file code of+ Left exception -> Control.Exception.throwIO exception+ Right parsedExpression -> return parsedExpression++ resolvedExpression <- Dhall.Import.load parsedExpression++ let mapKey = "mapKey"+ let mapValue = "mapValue"+ let conversion = Conversion {..}++ let convertedExpression =+ Dhall.JSON.convertToHomogeneousMaps conversion resolvedExpression++ actualValue <- case Dhall.JSON.dhallToJSON convertedExpression of+ Left exception -> Control.Exception.throwIO exception+ Right actualValue -> return actualValue++ result <- Data.Aeson.eitherDecodeFileStrict "./tasty/data/issue48.json"++ expectedValue <- case result of+ Left string -> fail string+ Right expectedValue -> return expectedValue++ let message =+ "Conversion to homogeneous maps did not generate the expected JSON output"++ Test.Tasty.HUnit.assertEqual message expectedValue actualValue
+ tasty/data/issue48.dhall view
@@ -0,0 +1,1 @@+[ { mapKey = "somekey", mapValue = [ { mapKey = "\$gt", mapValue = 100 } ] } ]
+ tasty/data/issue48.json view
@@ -0,0 +1,5 @@+{+ "somekey": {+ "$gt": 100+ }+}