aeson-yaml 1.0.3.0 → 1.0.4.0
raw patch · 3 files changed
+64/−41 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- aeson-yaml.cabal +1/−1
- src/Data/Aeson/Yaml.hs +2/−2
- test/Test/Data/Aeson/Yaml.hs +61/−38
aeson-yaml.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: aeson-yaml-version: 1.0.3.0+version: 1.0.4.0 homepage: https://github.com/clovyr/aeson-yaml bug-reports: https://github.com/clovyr/aeson-yaml/issues author: Patrick Nielsen
src/Data/Aeson/Yaml.hs view
@@ -127,7 +127,7 @@ s /= "" && not isSpecial && isSafeAscii (Text.head s) &&- not (Text.all isNumberRelated s) && Text.all isAllowed s+ not (Text.all isNumberOrDateRelated s) && Text.all isAllowed s isSpecial | Text.length s > 5 = False | otherwise =@@ -139,7 +139,7 @@ (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '/' || c == '_' || c == '.' || c == '='- isNumberRelated c = isDigit c || c == '.' || c == 'e'+ isNumberOrDateRelated c = isDigit c || c == '.' || c == 'e' || c == '-' isAllowed c -- We don't include ' ' here to avoid sequences like " -" and ": " = isSafeAscii c || c == '-' || c == ':'
test/Test/Data/Aeson/Yaml.hs view
@@ -29,11 +29,14 @@ } testCases :: [TestCase]-testCases =- [ TestCase- { tcName = "Nested lists and objects"- , tcInput =- [s|+testCases = [tcDataTypes, tcNestedListsAndObjects, tcQuoted]++tcDataTypes :: TestCase+tcDataTypes =+ TestCase+ { tcName = "Data types"+ , tcInput =+ [s| { "nullValue": null, "isTrue": true,@@ -41,13 +44,51 @@ "numberString": "12345", "quoted ! key": true, "boolString": "true",+ "dateString": "2038-01-19", "piString": "3.14", "expString": "1e3",+ "asteriskString": "*", "multiLine": "The first line is followed by the\nsecond line\n", "multiLineWithSpaces": " This has extra\n spaces at the beginning\n", "notMultiline": "This won't be\nmulti-lined", "list": ["foo", "bar", "baz"],- "listEmpty": [],+ "listEmpty": []+}+|]+ , tcOutput =+ [s|asteriskString: "*"+boolString: "true"+dateString: "2038-01-19"+expString: "1e3"+isFalse: false+isTrue: true+list:+ - foo+ - bar+ - baz+listEmpty: []+multiLine: |+ The first line is followed by the+ second line+multiLineWithSpaces: |2+ This has extra+ spaces at the beginning+notMultiline: "This won't be\nmulti-lined"+nullValue: null+numberString: "12345"+piString: "3.14"+"quoted ! key": true+|]+ , tcAlwaysQuote = False+ }++tcNestedListsAndObjects :: TestCase+tcNestedListsAndObjects =+ TestCase+ { tcName = "Nested lists and objects"+ , tcInput =+ [s|+{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": {@@ -102,33 +143,13 @@ } } |]- , tcOutput =- [s|apiVersion: apps/v1-boolString: "true"-expString: "1e3"-isFalse: false-isTrue: true+ , tcOutput =+ [s|apiVersion: apps/v1 kind: Deployment-list:- - foo- - bar- - baz-listEmpty: [] metadata: labels: app: foo name: "{{ .Release.Name }}-deployment"-multiLine: |- The first line is followed by the- second line-multiLineWithSpaces: |2- This has extra- spaces at the beginning-notMultiline: "This won't be\nmulti-lined"-nullValue: null-numberString: "12345"-piString: "3.14"-"quoted ! key": true spec: replicas: 1 selector:@@ -157,18 +178,20 @@ - mountPath: /data/mount2 name: "{{ .Release.Name }}-volume-mount2" |]- , tcAlwaysQuote = False- }- , TestCase- { tcName = "Quoted"- , tcInput = [s|{"foo": "bar", "baz": "quux"}|]- , tcOutput =- [s|'baz': 'quux'+ , tcAlwaysQuote = False+ }++tcQuoted :: TestCase+tcQuoted =+ TestCase+ { tcName = "Quoted"+ , tcInput = [s|{"foo": "bar", "baz": "quux"}|]+ , tcOutput =+ [s|'baz': 'quux' 'foo': 'bar' |]- , tcAlwaysQuote = True- }- ]+ , tcAlwaysQuote = True+ } foo :: Data.Aeson.Value foo = Data.Aeson.Object $ HashMap.fromList [("foo", "bar")]