on master help sign in
OK, really drop aeson-qq
7c19550Michael Snoyman
ChangeLog.md+1−1
@@ -1,6 +1,6 @@
1## 0.8.25.1
1## 0.8.25.1
2
2
3−* Drop unused aeson-qq dep
3+* Drop aeson-qq dep (incompatible with Stackage Nightly)
4
4
5## 0.8.25
5## 0.8.25
6
6
test/Data/Yaml/IncludeSpec.hs+22−18
@@ -1,10 +1,9 @@
1−{-# LANGUAGE QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Data.Yaml.IncludeSpec (main, spec) where
2module Data.Yaml.IncludeSpec (main, spec) where
3
3
4import Test.Hspec
4import Test.Hspec
5import Data.List (isPrefixOf)
5import Data.List (isPrefixOf)
6import Data.Aeson
6import Data.Aeson
7−import Data.Aeson.QQ
8import Data.Yaml (ParseException(InvalidYaml))
7import Data.Yaml (ParseException(InvalidYaml))
9import Data.Yaml.Include
8import Data.Yaml.Include
10import Text.Libyaml (YamlException(YamlException))
9import Text.Libyaml (YamlException(YamlException))
@@ -12,28 +11,33 @@ import Text.Libyaml (YamlException(YamlException))
12main :: IO ()
11main :: IO ()
13main = hspec spec
12main = hspec spec
14
13
14+asInt :: Int -> Int
15+asInt = id
16+
15spec :: Spec
17spec :: Spec
16spec = do
18spec = do
17 describe "decodeFile" $ do
19 describe "decodeFile" $ do
18 it "supports includes" $ do
20 it "supports includes" $ do
19− decodeFile "test/resources/foo.yaml" `shouldReturn` Just [aesonQQ|
21+ decodeFile "test/resources/foo.yaml" `shouldReturn` Just (object
20− {
21− foo: 23,
22+ [ "foo" .= asInt 23
23+ , "bar" .= object
22− bar: {one: 1, two: 2},
24+ [ "one" .= asInt 1
25+ , "two" .= asInt 2
26+ ]
23− baz: 42
27+ , "baz" .= asInt 42
24− }
25− |]
28+ ])
26
29
27 it "supports recursive includes" $ do
30 it "supports recursive includes" $ do
28− decodeFile "test/resources/baz.yaml" `shouldReturn` Just [aesonQQ|
31+ decodeFile "test/resources/baz.yaml" `shouldReturn` Just (object
29− {
30− foo: {
32+ [ "foo" .= object
31− foo: 23,
33+ [ "foo" .= asInt 23
34+ , "bar" .= object
32− bar: {one: 1, two: 2},
35+ [ "one" .= asInt 1
36+ , "two" .= asInt 2
37+ ]
33− baz: 42
38+ , "baz" .= asInt 42
34− }
39+ ]
35− }
36− |]
40+ ])
37
41
38 it "aborts on cyclic includes" $ do
42 it "aborts on cyclic includes" $ do
39 (decodeFile "test/resources/loop/foo.yaml" :: IO (Maybe Value)) `shouldThrow` anyException
43 (decodeFile "test/resources/loop/foo.yaml" :: IO (Maybe Value)) `shouldThrow` anyException