feat(variable): Allow accessing dictionary count

This commit is contained in:
Yonas Kolb
2017-05-02 14:52:55 +08:00
committed by Kyle Fuller
parent 3180b26673
commit 14bac03990
3 changed files with 16 additions and 1 deletions

View File

@@ -26,6 +26,9 @@ func testVariable() {
"profiles": [
"github": "kylef",
],
"counter": [
"count": "kylef",
],
"article": Article(author: Person(name: "Kyle"))
])
@@ -107,6 +110,12 @@ func testVariable() {
try expect(result) == "Kyle"
}
$0.it("can get the count of a dictionary") {
let variable = Variable("profiles.count")
let result = try variable.resolve(context) as? Int
try expect(result) == 1
}
#if os(OSX)
$0.it("can resolve a value via KVO") {
let variable = Variable("object.title")