Add a Template Loader

This commit is contained in:
Kyle Fuller
2014-12-28 23:32:13 +00:00
parent 2374786963
commit 1989c20932
8 changed files with 178 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
import Foundation
import XCTest
import Stencil
import PathKit
class TemplateLoaderTests: XCTestCase {
func testLoadingUnknownTemplate() {
let loader = TemplateLoader(paths:[])
XCTAssertNil(loader.loadTemplate("unknown.html"))
}
func testLoadingUnknownTemplates() {
let loader = TemplateLoader(paths:[])
XCTAssertNil(loader.loadTemplate(["unknown.html", "unknown2.html"]))
}
func testLoadingTemplate() {
let path = (Path(__FILE__) + Path("..")).absolute()
let loader = TemplateLoader(paths: [path])
XCTAssertTrue(loader.loadTemplate("test.html") != nil)
}
}

1
StencilTests/test.html Normal file
View File

@@ -0,0 +1 @@
Hello {{ target }}.