Include tests for README

This commit is contained in:
Kyle Fuller
2014-10-25 15:13:30 +01:00
parent 98771558ca
commit 455845d80c

View File

@@ -8,29 +8,32 @@
import Cocoa import Cocoa
import XCTest import XCTest
import Stencil
class StencilTests: XCTestCase { class StencilTests: XCTestCase {
func testReadmeExample() {
let templateString = "There are {{ articles.count }} articles.\n" +
"\n" +
"{% for article in articles %}" +
" - {{ article.title }} by {{ article.author }}.\n" +
"{% endfor %}\n"
override func setUp() { let context = Context(dictionary: [
super.setUp() "articles": [
// Put setup code here. This method is called before the invocation of each test method in the class. [ "title": "Migrating from OCUnit to XCTest", "author": "Kyle Fuller" ],
} [ "title": "Memory Management with ARC", "author": "Kyle Fuller" ],
]
])
override func tearDown() { let template = Template(templateString:templateString)
// Put teardown code here. This method is called after the invocation of each test method in the class. let result = template.render(context)
super.tearDown()
}
func testExample() { let fixture = "There are 2 articles.\n" +
// This is an example of a functional test case. "\n" +
XCTAssert(true, "Pass") " - Migrating from OCUnit to XCTest by Kyle Fuller.\n" +
} " - Memory Management with ARC by Kyle Fuller.\n" +
"\n"
func testPerformanceExample() { XCTAssertEqual(result.string!, fixture)
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
} }
}
} }