reenabled clear test, made clear working (#5323)

This commit is contained in:
Arne Döring 2017-02-02 23:06:13 +01:00 • committed by Andreas Rumpf
commit 2c6c865b35
2 changed files with 23 additions and 22 deletions

View file

@ -814,10 +814,13 @@ proc len*[A](t: CountTable[A]): int =
## returns the number of keys in `t`. ## returns the number of keys in `t`.
result = t.counter result = t.counter
proc clear*[A](t: var CountTable[A] | CountTableRef[A]) = proc clear*[A](t: CountTableRef[A]) =
## Resets the table so that it is empty.
clearImpl()
proc clear*[A](t: var CountTable[A]) =
## Resets the table so that it is empty. ## Resets the table so that it is empty.
clearImpl() clearImpl()
t.counter = 0
iterator pairs*[A](t: CountTable[A]): (A, int) = iterator pairs*[A](t: CountTable[A]): (A, int) =
## iterates over any (key, value) pair in the table `t`. ## iterates over any (key, value) pair in the table `t`.

View file

@ -190,8 +190,6 @@ block zeroHashKeysTest:
doZeroHashValueTest(toOrderedTable[string,string]({"egg": "sausage"}), doZeroHashValueTest(toOrderedTable[string,string]({"egg": "sausage"}),
"", "spam") "", "spam")
# Until #4448 is fixed, these tests will fail
when false:
block clearTableTest: block clearTableTest:
var t = data.toTable var t = data.toTable
assert t.len() != 0 assert t.len() != 0