Fix tests to be string hash order independent (#551)
This commit is contained in:
parent
13d28a5b71
commit
8f609b6c17
|
@ -13,6 +13,11 @@ import stew/base10
|
||||||
|
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
|
# Trouble finding this if defined near its use for `data2.sorted`, etc. likely
|
||||||
|
# related to "generic sandwich" issues. If any test ever wants to `sort` a
|
||||||
|
# `seq[(string, seq[string]]` differently, they may need to re-work that test.
|
||||||
|
proc `<`(a, b: (string, seq[string])): bool = a[0] < b[0]
|
||||||
|
|
||||||
suite "HTTP server testing suite":
|
suite "HTTP server testing suite":
|
||||||
teardown:
|
teardown:
|
||||||
checkLeaks()
|
checkLeaks()
|
||||||
|
@ -846,11 +851,11 @@ suite "HTTP server testing suite":
|
||||||
for key, value in table1.items(true):
|
for key, value in table1.items(true):
|
||||||
data2.add((key, value))
|
data2.add((key, value))
|
||||||
|
|
||||||
check:
|
check: # .sorted to not depend upon hash(key)-order
|
||||||
data1 == @[("Header2", "value2"), ("Header2", "VALUE3"),
|
data1.sorted == sorted(@[("Header2", "value2"), ("Header2", "VALUE3"),
|
||||||
("Header1", "value1")]
|
("Header1", "value1")])
|
||||||
data2 == @[("Header2", @["value2", "VALUE3"]),
|
data2.sorted == sorted(@[("Header2", @["value2", "VALUE3"]),
|
||||||
("Header1", @["value1"])]
|
("Header1", @["value1"])])
|
||||||
|
|
||||||
table1.set("header2", "value4")
|
table1.set("header2", "value4")
|
||||||
check:
|
check:
|
||||||
|
|
Loading…
Reference in New Issue