summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-06-25 14:12:23 +0200
committerGitHub <noreply@github.com>2021-06-25 14:12:23 +0200
commitceb9e3efc9111f7dda47726c71d2476624ce92c2 (patch)
tree49a4bc1c671d5ccd4a38a4ee0f05ddacf4a31076 /tests
parent0d194cdbf90953f28450c4bf1db744d2c1332996 (diff)
downloadNim-ceb9e3efc9111f7dda47726c71d2476624ce92c2.tar.gz
fixes #18240 (#18354)
* ORC: track escaping parameters properly

* fixes #18240
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/torcmisc.nim32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/arc/torcmisc.nim b/tests/arc/torcmisc.nim
index 20dd18fb3..e41ad7c77 100644
--- a/tests/arc/torcmisc.nim
+++ b/tests/arc/torcmisc.nim
@@ -32,3 +32,35 @@ when true:
   waitFor hello(Flags())
   echo "success"
 
+# bug #18240
+import tables
+
+type
+  TopicHandler* = proc(topic: string,
+                       data: seq[byte]): Future[void] {.gcsafe, raises: [Defect].}
+
+  PeerID* = object
+    data*: seq[byte]
+
+  PeerInfo* = ref object of RootObj
+    peerId*: PeerID
+
+  Connection* = ref object of RootObj
+    peerInfo*: PeerInfo
+
+  PubSubPeer* = ref object of RootObj
+    codec*: string
+
+  PubSub* = ref object of RootObj
+    topics*: Table[string, seq[TopicHandler]]
+    peers*: Table[PeerID, PubSubPeer]
+
+proc getOrCreatePeer*(myParam: PubSub, peerId: PeerID, protos: seq[string]): PubSubPeer =
+  myParam.peers.withValue(peerId, peer):
+    return peer[]
+
+method handleConn*(myParam: PubSub,
+                  conn: Connection,
+                  proto: string) {.base, async.} =
+  myParam.peers.withValue(conn.peerInfo.peerId, peer):
+    let peerB = peer[]