summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/async/tasyncawait.nim4
-rw-r--r--tests/js/tbasicenum.nim10
-rw-r--r--tests/js/tbasics.nim37
3 files changed, 41 insertions, 10 deletions
diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim
index 1e6cf3761..063c8317c 100644
--- a/tests/async/tasyncawait.nim
+++ b/tests/async/tasyncawait.nim
@@ -26,6 +26,10 @@ proc launchSwarm(port: Port) {.async.} =
 proc readMessages(client: AsyncFD) {.async.} =
   # wrapping the AsyncFd into a AsyncSocket object
   var sockObj = newAsyncSocket(client)
+  var (ipaddr, port) = sockObj.getPeerAddr()
+  doAssert ipaddr == "127.0.0.1"
+  (ipaddr, port) = sockObj.getLocalAddr()
+  doAssert ipaddr == "127.0.0.1"
   while true:
     var line = await recvLine(sockObj)
     if line == "":
diff --git a/tests/js/tbasicenum.nim b/tests/js/tbasicenum.nim
deleted file mode 100644
index a9e9ce2da..000000000
--- a/tests/js/tbasicenum.nim
+++ /dev/null
@@ -1,10 +0,0 @@
-discard """
-  output: "ABCDC"
-"""
-
-type
-  MyEnum = enum
-    A,B,C,D
-# trick the optimizer with an seq:
-var x = @[A,B,C,D]
-echo x[0],x[1],x[2],x[3],MyEnum(2)
\ No newline at end of file
diff --git a/tests/js/tbasics.nim b/tests/js/tbasics.nim
new file mode 100644
index 000000000..0c8d33e7f
--- /dev/null
+++ b/tests/js/tbasics.nim
@@ -0,0 +1,37 @@
+discard """
+  output: '''ABCDC
+1
+14
+ok'''
+"""
+
+type
+  MyEnum = enum
+    A,B,C,D
+# trick the optimizer with an seq:
+var x = @[A,B,C,D]
+echo x[0],x[1],x[2],x[3],MyEnum(2)
+
+# bug #10651
+
+var xa: seq[int]
+var ya = @[1,2]
+xa &= ya
+echo xa[0]
+
+proc test =
+  var yup: seq[int]
+  try:
+    yup.add 14
+    echo yup.pop
+  finally:
+    discard
+
+test()
+
+when true:
+  var a: seq[int]
+
+  a.setLen(0)
+
+  echo "ok"
\ No newline at end of file