diff --git a/Tests/Fixtures/yaml.yml b/Tests/Fixtures/yaml.yml new file mode 100644 index 00000000..95413131 --- /dev/null +++ b/Tests/Fixtures/yaml.yml @@ -0,0 +1,19 @@ +true: true +false: false +yes: YES +no: NO +yesQuote: "YES" +noQuote: "NO" +int: 1 +intQuote: "1" +float: 3.2 +string: hello +stringQuote: "hello" +space: " " +empty: +emptyQuote: "" +emptyDictionary: {} +arrayLiteral: [1,2] +arrayList: + - 1 + - 2 diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift index 12adcba8..8b64c9bc 100644 --- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift +++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift @@ -3,6 +3,7 @@ import ProjectSpec import Spectre import XcodeGenKit import xcproj +import Foundation func specLoadingTests() { @@ -46,6 +47,34 @@ func specLoadingTests() { Target(name: "NewTarget", type: .application, platform: .iOS), ] } + + $0.it("parses yaml types") { + let path = fixturePath + "yaml.yml" + let dictionary = try loadYamlDictionary(path: path) + let expectedDictionary: [String: Any] = [ + "true": true, + "false": false, + "yes": true, + "no": false, + "yesQuote": true, + "noQuote": false, + "int": 1, + "intQuote": 1, + "float": 3.2, + "string": "hello", + "stringQuote": "hello", + "space": " ", + "empty": "", + "emptyQuote": "", + "emptyDictionary": [String: Any](), + "arrayLiteral": [1,2], + "arrayList": [1,2], + ] + + if !(dictionary as NSDictionary).isEqual(expectedDictionary) { + throw failure("parsed yaml types don't match") + } + } } describe("Spec Loader JSON") {