Skip to content

Commit

Permalink
remove annoying messages when creating orderedTables (#15309)
Browse files Browse the repository at this point in the history
* nativesockets docs minor [backport: 1.2]

* remove annoying messages

(cherry picked from commit a41b243)
  • Loading branch information
ringabout authored and narimiran committed Sep 21, 2020
1 parent 6eb656a commit 183f876
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/pure/collections/tables.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): <//>OrderedTableRef[A, B]
assert b == {'a': 5, 'b': 9}.newOrderedTable

result = newOrderedTable[A, B](rightSize(pairs.len))
for key, val in items(pairs): result.add(key, val)
for key, val in items(pairs): result[key] = val


proc `[]`*[A, B](t: OrderedTableRef[A, B], key: A): var B =
Expand Down Expand Up @@ -3002,37 +3002,37 @@ when isMainModule:
block: #5482
var a = [("wrong?", "foo"), ("wrong?", "foo2")].newOrderedTable()
var b = newOrderedTable[string, string](initialSize = 2)
b.add("wrong?", "foo")
b.add("wrong?", "foo2")
b["wrong?"] = "foo"
b["wrong?"] = "foo2"
assert a == b

block: #5482
var a = {"wrong?": "foo", "wrong?": "foo2"}.newOrderedTable()
var b = newOrderedTable[string, string](initialSize = 2)
b.add("wrong?", "foo")
b.add("wrong?", "foo2")
b["wrong?"] = "foo"
b["wrong?"] = "foo2"
assert a == b

block: #5487
var a = {"wrong?": "foo", "wrong?": "foo2"}.newOrderedTable()
var b = newOrderedTable[string, string]() # notice, default size!
b.add("wrong?", "foo")
b.add("wrong?", "foo2")
b["wrong?"] = "foo"
b["wrong?"] = "foo2"
assert a == b

block: #5487
var a = [("wrong?", "foo"), ("wrong?", "foo2")].newOrderedTable()
var b = newOrderedTable[string, string]() # notice, default size!
b.add("wrong?", "foo")
b.add("wrong?", "foo2")
b["wrong?"] = "foo"
b["wrong?"] = "foo2"
assert a == b

block:
var a = {"wrong?": "foo", "wrong?": "foo2"}.newOrderedTable()
var b = [("wrong?", "foo"), ("wrong?", "foo2")].newOrderedTable()
var c = newOrderedTable[string, string]() # notice, default size!
c.add("wrong?", "foo")
c.add("wrong?", "foo2")
c["wrong?"] = "foo"
c["wrong?"] = "foo2"
assert a == b
assert a == c

Expand Down

0 comments on commit 183f876

Please sign in to comment.