yaml 0.8.6 → 0.8.6.1
raw patch · 3 files changed
+13/−3 lines, 3 files
Files
- Data/Yaml.hs +11/−1
- test/main.hs +1/−1
- yaml.cabal +1/−1
Data/Yaml.hs view
@@ -134,7 +134,7 @@ event -- Make sure that special strings are encoded as strings properly. -- See: https://github.com/snoyberg/yaml/issues/31- | s `HashSet.member` specialStrings = EventScalar (encodeUtf8 s) NoTag SingleQuoted Nothing+ | s `HashSet.member` specialStrings || isNumeric s = EventScalar (encodeUtf8 s) NoTag SingleQuoted Nothing | otherwise = EventScalar (encodeUtf8 s) StrTag PlainNoTag Nothing objToEvents' Null rest = EventScalar "null" NullTag PlainNoTag Nothing : rest objToEvents' (Bool True) rest = EventScalar "true" BoolTag PlainNoTag Nothing : rest@@ -150,6 +150,16 @@ specialStrings :: HashSet.HashSet Text specialStrings = HashSet.fromList $ T.words "y Y yes Yes YES n N no No NO true True TRUE false False FALSE on On ON off Off OFF null Null NULL ~"++isNumeric :: Text -> Bool+isNumeric =+ T.all isNumeric'+ where+ isNumeric' c = ('0' <= c && c <= '9')+ || c == 'e'+ || c == 'E'+ || c == '.'+ || c == '-' -- Parsing
test/main.hs view
@@ -124,7 +124,7 @@ } describe "round-tripping of special scalars" $ do- let special = words "y Y On ON false"+ let special = words "y Y On ON false 12345 12345.0 12345a 12e3" forM_ special $ \w -> it w $ let v = object ["word" .= w] in D.decode (D.encode v) `shouldBe` Just v
yaml.cabal view
@@ -1,5 +1,5 @@ name: yaml-version: 0.8.6+version: 0.8.6.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov