summary refs log tree commit diff stats
path: root/tests/parallel
diff options
context:
space:
mode:
authorc-blake <c-blake@users.noreply.github.com>2024-07-07 10:51:42 +0000
committerGitHub <noreply@github.com>2024-07-07 12:51:42 +0200
commit4faa15f3ad6504c3ba808e63ecd729d3fc3cb78a (patch)
treef60e8f2524195c8605d6f3e8e6c478a5534f0ab9 /tests/parallel
parent1dcc364cd2e284f831735e0fe9b988b08c82ac4f (diff)
downloadNim-4faa15f3ad6504c3ba808e63ecd729d3fc3cb78a.tar.gz
Replacement PR for https://github.com/nim-lang/Nim/pull/23779 that (#23793)
makes new hash the default, with an opt-out (& js-no-big-int) define.
Also update changelog (& fix one typo).

Only really expect the chronos hash-order sensitive test to fail until
they merge that PR and tag a new release.
Diffstat (limited to 'tests/parallel')
-rw-r--r--tests/parallel/tsendtwice.nim21
1 files changed, 7 insertions, 14 deletions
diff --git a/tests/parallel/tsendtwice.nim b/tests/parallel/tsendtwice.nim
index 6bf5e5ebb..9f4a2e06e 100644
--- a/tests/parallel/tsendtwice.nim
+++ b/tests/parallel/tsendtwice.nim
@@ -1,18 +1,10 @@
 discard """
-  output: '''ob2 @[]
-ob @[]
-ob3 @[]
-3
-ob2 @[]
-ob @[]
-ob3 @[]
-'''
   matrix: "--mm:refc"
 """
 
 # bug #4776
 
-import tables
+import tables, algorithm
 
 type
   Base* = ref object of RootObj
@@ -35,20 +27,21 @@ globalTable.add("ob", d)
 globalTable.add("ob2", d)
 globalTable.add("ob3", d)
 
+proc `<`(x, y: seq[int]): bool = x.len < y.len
+proc kvs(t: TableRef[string, Base]): seq[(string, seq[int])] =
+  for k, v in t.pairs: result.add (k, v.someSeq)
+  result.sort
+
 proc testThread(channel: ptr TableChannel) {.thread.} =
   globalTable = channel[].recv()
-  for k, v in pairs globaltable:
-    echo k, " ", v.someSeq
   var myObj: Base
   deepCopy(myObj, globalTable["ob"])
   myObj.someSeq = newSeq[int](100)
   let table = channel[].recv() # same table
-  echo table.len
-  for k, v in mpairs table:
-    echo k, " ", v.someSeq
   assert(table.contains("ob")) # fails!
   assert(table.contains("ob2")) # fails!
   assert(table.contains("ob3")) # fails!
+  assert table.kvs == globalTable.kvs # Last to see above spot checks first
 
 var channel: TableChannel