Skip to content

Commit 9cc4e92

Browse files
committed
update to Spectre 0.9.0
1 parent df2e193 commit 9cc4e92

24 files changed

Lines changed: 2136 additions & 1980 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.conche/
22
.build/
33
Packages/
4-
Package.resolved
54
Package.pins
65
*.xcodeproj

Package.resolved

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
],
99
dependencies: [
1010
.package(url: "https://github.com/kylef/PathKit.git", from: "0.9.0"),
11-
.package(url: "https://github.com/kylef/Spectre.git", from: "0.8.0"),
11+
.package(url: "https://github.com/kylef/Spectre.git", from: "0.9.0"),
1212
],
1313
targets: [
1414
.target(name: "Stencil", dependencies: [

Tests/LinuxMain.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import XCTest
2+
13
import StencilTests
24

3-
stencilTests()
5+
var tests = [XCTestCaseEntry]()
6+
tests += StencilTests.__allTests()
7+
8+
XCTMain(tests)

Tests/StencilTests/ContextSpec.swift

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,84 @@
1+
import XCTest
12
import Spectre
23
@testable import Stencil
34

45

5-
func testContext() {
6-
describe("Context") {
7-
var context: Context!
6+
class ContextTests: XCTestCase {
7+
8+
func testContext() {
9+
describe("Context") {
10+
var context: Context!
811

9-
$0.before {
10-
context = Context(dictionary: ["name": "Kyle"])
11-
}
12+
$0.before {
13+
context = Context(dictionary: ["name": "Kyle"])
14+
}
1215

13-
$0.it("allows you to get a value via subscripting") {
14-
try expect(context["name"] as? String) == "Kyle"
15-
}
16+
$0.it("allows you to get a value via subscripting") {
17+
try expect(context["name"] as? String) == "Kyle"
18+
}
1619

17-
$0.it("allows you to set a value via subscripting") {
18-
context["name"] = "Katie"
20+
$0.it("allows you to set a value via subscripting") {
21+
context["name"] = "Katie"
1922

20-
try expect(context["name"] as? String) == "Katie"
21-
}
23+
try expect(context["name"] as? String) == "Katie"
24+
}
2225

23-
$0.it("allows you to remove a value via subscripting") {
24-
context["name"] = nil
26+
$0.it("allows you to remove a value via subscripting") {
27+
context["name"] = nil
2528

26-
try expect(context["name"]).to.beNil()
27-
}
29+
try expect(context["name"]).to.beNil()
30+
}
2831

29-
$0.it("allows you to retrieve a value from a parent") {
30-
try context.push {
31-
try expect(context["name"] as? String) == "Kyle"
32+
$0.it("allows you to retrieve a value from a parent") {
33+
try context.push {
34+
try expect(context["name"] as? String) == "Kyle"
35+
}
3236
}
33-
}
3437

35-
$0.it("allows you to override a parent's value") {
36-
try context.push {
37-
context["name"] = "Katie"
38-
try expect(context["name"] as? String) == "Katie"
38+
$0.it("allows you to override a parent's value") {
39+
try context.push {
40+
context["name"] = "Katie"
41+
try expect(context["name"] as? String) == "Katie"
42+
}
3943
}
40-
}
4144

42-
$0.it("allows you to pop to restore previous state") {
43-
context.push {
44-
context["name"] = "Katie"
45+
$0.it("allows you to pop to restore previous state") {
46+
context.push {
47+
context["name"] = "Katie"
48+
}
49+
50+
try expect(context["name"] as? String) == "Kyle"
4551
}
4652

47-
try expect(context["name"] as? String) == "Kyle"
48-
}
53+
$0.it("allows you to remove a parent's value in a level") {
54+
try context.push {
55+
context["name"] = nil
56+
try expect(context["name"]).to.beNil()
57+
}
4958

50-
$0.it("allows you to remove a parent's value in a level") {
51-
try context.push {
52-
context["name"] = nil
53-
try expect(context["name"]).to.beNil()
59+
try expect(context["name"] as? String) == "Kyle"
5460
}
5561

56-
try expect(context["name"] as? String) == "Kyle"
57-
}
62+
$0.it("allows you to push a dictionary and run a closure then restoring previous state") {
63+
var didRun = false
5864

59-
$0.it("allows you to push a dictionary and run a closure then restoring previous state") {
60-
var didRun = false
65+
try context.push(dictionary: ["name": "Katie"]) {
66+
didRun = true
67+
try expect(context["name"] as? String) == "Katie"
68+
}
6169

62-
try context.push(dictionary: ["name": "Katie"]) {
63-
didRun = true
64-
try expect(context["name"] as? String) == "Katie"
70+
try expect(didRun).to.beTrue()
71+
try expect(context["name"] as? String) == "Kyle"
6572
}
6673

67-
try expect(didRun).to.beTrue()
68-
try expect(context["name"] as? String) == "Kyle"
69-
}
70-
71-
$0.it("allows you to flatten the context contents") {
72-
try context.push(dictionary: ["test": "abc"]) {
73-
let flattened = context.flatten()
74+
$0.it("allows you to flatten the context contents") {
75+
try context.push(dictionary: ["test": "abc"]) {
76+
let flattened = context.flatten()
7477

75-
try expect(flattened.count) == 2
76-
try expect(flattened["name"] as? String) == "Kyle"
77-
try expect(flattened["test"] as? String) == "abc"
78+
try expect(flattened.count) == 2
79+
try expect(flattened["name"] as? String) == "Kyle"
80+
try expect(flattened["test"] as? String) == "abc"
81+
}
7882
}
7983
}
8084
}

0 commit comments

Comments
 (0)