Skip to content

Commit d3e6ec1

Browse files
authored
Merge pull request #66 from plummer/test/test-add-offset-loop-test
Test - Add check for new offset in loop test
2 parents ed5a280 + d586271 commit d3e6ec1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Tests/LeafTests/ContextTests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ class ContextTests: XCTestCase {
5151
}
5252

5353
func testLoop() throws {
54-
let raw = "#loop(friends, \"friend\") { Hello, #(friend) from #(index)! }"
54+
let raw = "#loop(friends, \"friend\") { Hi, #(friend) from #(index)(#(offset))! }"
5555
let template = try stem.spawnLeaf(raw: raw)
5656
let context = Context(["friends": ["a", "b", "c", "#loop"]])
5757
let rendered = try stem.render(template, with: context).makeString()
58-
let expectation = "Hello, a from 0!\nHello, b from 1!\nHello, c from 2!\nHello, #loop from 3!"
58+
let expectation = "Hi, a from 0(1)!\nHi, b from 1(2)!\nHi, c from 2(3)!\nHi, #loop from 3(4)!"
59+
5960
XCTAssert(rendered == expectation)
6061
}
6162

0 commit comments

Comments
 (0)