diff --git a/tests/testhttpserver.nim b/tests/testhttpserver.nim index 70cca33e..4cc61a07 100644 --- a/tests/testhttpserver.nim +++ b/tests/testhttpserver.nim @@ -13,6 +13,11 @@ import stew/base10 {.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": teardown: checkLeaks() @@ -846,11 +851,11 @@ suite "HTTP server testing suite": for key, value in table1.items(true): data2.add((key, value)) - check: - data1 == @[("Header2", "value2"), ("Header2", "VALUE3"), - ("Header1", "value1")] - data2 == @[("Header2", @["value2", "VALUE3"]), - ("Header1", @["value1"])] + check: # .sorted to not depend upon hash(key)-order + data1.sorted == sorted(@[("Header2", "value2"), ("Header2", "VALUE3"), + ("Header1", "value1")]) + data2.sorted == sorted(@[("Header2", @["value2", "VALUE3"]), + ("Header1", @["value1"])]) table1.set("header2", "value4") check: