From 53005a3322c8a926a579a370caf40f34b5d43b87 Mon Sep 17 00:00:00 2001 From: Gustavo Perdomo Date: Thu, 25 May 2017 15:18:23 -0400 Subject: [PATCH] fix for vapor 2 --- Package.swift | 4 +- Sources/Parser.swift | 2 +- Tests/BMLTests/BMLTests.swift | 83 ----------------------------------- 3 files changed, 3 insertions(+), 86 deletions(-) diff --git a/Package.swift b/Package.swift index d834133..210de43 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "BML", dependencies: [ - .Package(url: "https://github.com/vapor/core.git", majorVersion: 1), - .Package(url: "https://github.com/vapor/node.git", majorVersion: 1) + .Package(url: "https://github.com/vapor/core.git", majorVersion: 2), + .Package(url: "https://github.com/vapor/node.git", majorVersion: 2) ] ) diff --git a/Sources/Parser.swift b/Sources/Parser.swift index 9ec943b..e0a65d5 100644 --- a/Sources/Parser.swift +++ b/Sources/Parser.swift @@ -167,7 +167,7 @@ extension XMLParser { } guard token == .greaterThan else { - throw Error.malformedXML("Expected `>` for tag: \(name.string)") + throw Error.malformedXML("Expected `>` for tag: \(name.makeString())") } // > diff --git a/Tests/BMLTests/BMLTests.swift b/Tests/BMLTests/BMLTests.swift index 9130531..9984ddb 100644 --- a/Tests/BMLTests/BMLTests.swift +++ b/Tests/BMLTests/BMLTests.swift @@ -366,86 +366,3 @@ extension BML { } } - -extension Node { - func expect( - objects expectedObjects: [String], - file: StaticString = #file, - line: UInt = #line - ) { - if case .object(var rootObjects) = self { - expectedObjects.forEach { - XCTAssertNotNil(rootObjects[$0], file: file, line: line) - rootObjects.removeValue(forKey: $0) - } - - rootObjects.forEach { - XCTFail("Extra, unexpected object: \($0.key)", file: file, line: line) - } - } else { - XCTFail("Expected root object") - } - } - - func expect( - fields expectedFields: [String: NodeRepresentable], - file: StaticString = #file, - line: UInt = #line - ) { - if case .object(var rootObjects) = self { - expectedFields.forEach { - if let field = rootObjects[$0.key] { - XCTAssertEqual( - field, try! $0.value.makeNode(), - file: file, line: line - ) - } else { - XCTFail("Expected key: \($0.key)", file: file, line: line) - } - - rootObjects.removeValue(forKey: $0.key) - } - - rootObjects.forEach { - XCTFail("Extra, unexpected field: \($0.key)", file: file, line: line) - } - } else { - XCTFail("Expected root object") - } - } - - func expectObject( - named name: String, - containing expected: [(String, NodeRepresentable)], - file: StaticString = #file, - line: UInt = #line - ) { - if let entry = self[name] , case .object(var object) = entry { - expected.forEach { key, expectedValue in - if let value = object[key] { - XCTAssertEqual( - value, - try! expectedValue.makeNode(), - file: file, - line: line - ) - - object.removeValue(forKey: key) - - } else { - XCTFail( - "Expected value \(expectedValue) for \"\(key)\" in \(name)", - file: file, - line: line - ) - } - } - - object.forEach { - XCTFail("Extra key: \($0.key)", file: file, line: line) - } - } else { - XCTFail("Expected object `\(name)` in Node", file: file, line: line) - } - } -}