mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-10-27 06:21:28 +03:00
add yaml tests
This commit is contained in:
parent
9b7f8606c2
commit
9e02dbd420
19
Tests/Fixtures/yaml.yml
Normal file
19
Tests/Fixtures/yaml.yml
Normal file
@ -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
|
@ -3,6 +3,7 @@ import ProjectSpec
|
|||||||
import Spectre
|
import Spectre
|
||||||
import XcodeGenKit
|
import XcodeGenKit
|
||||||
import xcproj
|
import xcproj
|
||||||
|
import Foundation
|
||||||
|
|
||||||
func specLoadingTests() {
|
func specLoadingTests() {
|
||||||
|
|
||||||
@ -46,6 +47,34 @@ func specLoadingTests() {
|
|||||||
Target(name: "NewTarget", type: .application, platform: .iOS),
|
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") {
|
describe("Spec Loader JSON") {
|
||||||
|
Loading…
Reference in New Issue
Block a user