yaml 0.8.11 → 0.8.12
raw patch · 5 files changed
+17/−21 lines, 5 filesdep +base-compatdep +mockerydep −hspec-expectations
Dependencies added: base-compat, mockery
Dependencies removed: hspec-expectations
Files
- ChangeLog.md +4/−0
- Data/Yaml.hs +1/−0
- test/Data/Yaml/IncludeSpec.hs +1/−1
- test/Data/YamlSpec.hs +8/−17
- yaml.cabal +3/−3
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.8.12++* Proper handling of `String "+123"` [#64](https://github.com/snoyberg/yaml/issues/64)+ ## 0.8.11 * Function to print prettier parse exceptions [#59](https://github.com/snoyberg/yaml/pull/59)
Data/Yaml.hs view
@@ -158,6 +158,7 @@ || c == 'E' || c == '.' || c == '-'+ || c == '+' decode :: FromJSON a => ByteString
test/Data/Yaml/IncludeSpec.hs view
@@ -2,7 +2,7 @@ module Data.Yaml.IncludeSpec (main, spec) where import Test.Hspec-import Test.Hspec.Expectations.Contrib+import Data.Either.Compat import Data.Aeson import Data.Aeson.QQ import Data.Yaml (ParseException)
test/Data/YamlSpec.hs view
@@ -15,11 +15,11 @@ import qualified Control.Monad.Trans.Resource as C import qualified Data.Conduit.List as CL -import System.Directory import Control.Monad import Control.Exception (try, SomeException) import Test.Hspec-import Test.Hspec.Expectations.Contrib+import Data.Either.Compat+import Test.Mockery.Directory import qualified Data.Yaml as D import Data.Yaml (object, array, (.=))@@ -140,7 +140,10 @@ it "aliases in keys #49" caseIssue49 + it "serialization of +123 #64" $ do+ D.decode (D.encode ("+123" :: String)) `shouldBe` Just ("+123" :: String) + specialStrings :: [T.Text] specialStrings = [ "fo\"o"@@ -237,26 +240,17 @@ yamlString = "foo: bar\nbaz:\n - bin1\n - bin2\n" yamlBS = B8.pack yamlString -removeFile' :: FilePath -> IO ()-removeFile' fp = do- x <- doesFileExist fp- when x $ removeFile fp- caseEncodeDecodeFile :: Assertion-caseEncodeDecodeFile = do- removeFile' tmpPath+caseEncodeDecodeFile = withFile "" $ \tmpPath -> do eList <- C.runResourceT $ Y.decodeFile filePath C.$$ CL.consume C.runResourceT $ CL.sourceList eList C.$$ Y.encodeFile tmpPath eList2 <- C.runResourceT $ Y.decodeFile filePath C.$$ CL.consume map MyEvent eList @=? map MyEvent eList2 where filePath = "test/largest-string.yaml"- tmpPath = "tmp.yaml" caseInterleave :: Assertion-caseInterleave = do- removeFile' tmpPath- removeFile' tmpPath2+caseInterleave = withFile "" $ \tmpPath -> withFile "" $ \tmpPath2 -> do () <- C.runResourceT $ Y.decodeFile filePath C.$$ Y.encodeFile tmpPath () <- C.runResourceT $ Y.decodeFile tmpPath C.$$ Y.encodeFile tmpPath2 f1 <- readFile tmpPath@@ -264,8 +258,6 @@ f1 @=? f2 where filePath = "test/largest-string.yaml"- tmpPath = "tmp.yaml"- tmpPath2 = "tmp2.yaml" caseDecodeInvalidDocument :: Assertion caseDecodeInvalidDocument = do@@ -308,8 +300,7 @@ out @?= Just sample caseEncodeDecodeFileData :: Assertion-caseEncodeDecodeFileData = do- let fp = "tmp.yaml"+caseEncodeDecodeFileData = withFile "" $ \fp -> do D.encodeFile fp sample out <- D.decodeFile fp out @?= Just sample
yaml.cabal view
@@ -1,5 +1,5 @@ name: yaml-version: 0.8.11+version: 0.8.12 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov @@ -114,9 +114,7 @@ Data.Yaml.IncludeSpec cpp-options: -DTEST build-depends: hspec >= 1.3- , hspec-expectations , HUnit- , directory , base >= 4 && < 5 , transformers >= 0.1 , bytestring >= 0.9.1.4@@ -128,6 +126,8 @@ , vector , resourcet , aeson-qq+ , mockery+ , base-compat ghc-options: -Wall source-repository head