Removed deprecation warnings. Fixed broken test compilation.

This commit is contained in:
Kyle Jessup 2017-11-02 10:58:22 -04:00
parent 28723d7715
commit 60ab0b4d42
2 changed files with 7 additions and 4 deletions

View File

@ -422,7 +422,7 @@ public class MustachePartialTag : MustacheTag {
}
let withoutLast = page.deletingLastFilePathComponent
let slash = withoutLast[withoutLast.startIndex] == "/" ? "/" : ""
let pageDir = slash + withoutLast.characters.split(separator: "/").map(String.init).joined(separator: "/")
let pageDir = slash + withoutLast.split(separator: "/").map(String.init).joined(separator: "/")
let fullPath = pageDir + "/" + self.tag + "." + mustacheExtension
do {
let template = try getTemplateFromCache(fullPath)
@ -452,9 +452,9 @@ public class MustachePragmaTag : MustacheTag {
/// - returns: A Dictionary containing the pragma names and values.
public func parsePragma() -> Dictionary<String, String> {
var d = Dictionary<String, String>()
let commaSplit = tag.characters.split() { $0 == Character(",") }.map { String($0) }
let commaSplit = tag.split() { $0 == Character(",") }.map { String($0) }
for section in commaSplit {
let colonSplit = section.characters.split() { $0 == Character(":") }.map { String($0) }
let colonSplit = section.split() { $0 == Character(":") }.map { String($0) }
if colonSplit.count == 1 {
d[colonSplit[0]] = ""
} else if colonSplit.count > 1 {
@ -510,7 +510,7 @@ public class MustacheGroupTag : MustacheTag {
for child in children {
child.evaluate(context: contxt, collector: collector)
}
case let stringValue as String where stringValue.characters.count > 0:
case let stringValue as String where stringValue.count > 0:
for child in children {
child.evaluate(context: contxt, collector: collector)
}

View File

@ -5,6 +5,8 @@ import PerfectLib
@testable import PerfectMustache
class ShimHTTPRequest: HTTPRequest {
var pathComponents: [String] = []
var method = HTTPMethod.get
var path = "/"
var queryParams = [(String, String)]()
@ -27,6 +29,7 @@ class ShimHTTPRequest: HTTPRequest {
}
class ShimHTTPResponse: HTTPResponse {
func next() {}
var request: HTTPRequest = ShimHTTPRequest()
var status: HTTPResponseStatus = .ok
var isStreaming = false