-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from vapor/alternate-file-types
work with non leaf documents as raw bytes #2
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file #(won't) be #rendered() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Foundation | ||
import XCTest | ||
@testable import Leaf | ||
|
||
class FileLoadTests: XCTestCase { | ||
static let allTests = [ | ||
("testLoadRawBytes", testLoadRawBytes), | ||
] | ||
|
||
func testLoadRawBytes() throws { | ||
let leaf = try stem.spawnLeaf(named: "random-file.any") | ||
XCTAssert(Array(leaf.components).count == 1) | ||
|
||
let rendered = try stem.render(leaf, with: Context([])).string | ||
// tags are not parsed in non-leaf document | ||
let expectation = "This file #(won't) be #rendered() {}\n" | ||
XCTAssertEqual(rendered, expectation) | ||
|
||
// test cache | ||
_ = try stem.spawnLeaf(named: "random-file.any") | ||
} | ||
} |