Skip to content

Commit

Permalink
starlark/testdata: fix mistakes in tests (google#42)
Browse files Browse the repository at this point in the history
Fixes google#40
  • Loading branch information
adonovan authored Dec 5, 2018
1 parent 3b628ff commit ddacc25
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions starlark/testdata/dict.star
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ assert.eq(x9a.keys()[0], (1, 2))

# dict.get
x10 = {"a": 1}
assert.eq(x9.get("a"), 1)
assert.eq(x9.get("b"), None)
assert.eq(x9.get("a", 2), 1)
assert.eq(x9.get("b", 2), 2)
assert.eq(x10.get("a"), 1)
assert.eq(x10.get("b"), None)
assert.eq(x10.get("a", 2), 1)
assert.eq(x10.get("b", 2), 2)

# dict.clear
x11 = {"a": 1}
assert.contains(x10, "a")
assert.eq(x10["a"], 1)
x10.clear()
assert.fails(lambda: x10["a"], 'key "a" not in dict')
assert.true("a" not in x10)
freeze(x10)
assert.fails(x10.clear, "cannot clear frozen hash table")
assert.contains(x11, "a")
assert.eq(x11["a"], 1)
x11.clear()
assert.fails(lambda: x11["a"], 'key "a" not in dict')
assert.true("a" not in x11)
freeze(x11)
assert.fails(x11.clear, "cannot clear frozen hash table")

# dict.setdefault
x12 = {"a": 1}
Expand Down

0 comments on commit ddacc25

Please sign in to comment.