summary refs log tree commit diff stats
path: root/tests/misc
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-05-31 04:39:19 -0700
committerGitHub <noreply@github.com>2021-05-31 13:39:19 +0200
commita36efb59b5a74db6c5bbe6c0997c0221d0f55491 (patch)
tree37cede265df964aba98d162325243f87e64ba4d3 /tests/misc
parentb7ad29e692ffd9d12fdf4d42cd8ef2a63b9340d1 (diff)
downloadNim-a36efb59b5a74db6c5bbe6c0997c0221d0f55491.tar.gz
fix #16256: nimout: <empty> should give error (vacuously true); improve a few tests (#18089)
* fix #16256: nimout: <empty> should give error (vacuously true); improve some tests

* renamed:    tests/stdlib/t9710.nim -> tests/misc/t9710.nim

* improve tests

* fix non-DRY tests

* improve $nim_prs_D/tests/stdlib/t9091.nim

* renamed:    tests/stdlib/t9091.nim -> tests/misc/t9091.nim

* fixup

* address comment: doAssert => result.parseErrors
Diffstat (limited to 'tests/misc')
-rw-r--r--tests/misc/t9091.nim33
-rw-r--r--tests/misc/t9710.nim6
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/misc/t9091.nim b/tests/misc/t9091.nim
new file mode 100644
index 000000000..6e7a98ca5
--- /dev/null
+++ b/tests/misc/t9091.nim
@@ -0,0 +1,33 @@
+# bug #9091
+
+import streams
+
+block:
+  type Mine = ref object
+    a: int
+
+  proc write(io: Stream, t: Mine) =
+    io.write("sure")
+
+  let str = newStringStream()
+  let mi = new Mine
+
+  str.write(mi)
+  str.setPosition 0
+  doAssert str.readAll == "sure"
+
+block:
+  type
+    AObj = object
+      x: int
+
+  proc foo(a: int): string = ""
+
+  proc test(args: varargs[string, foo]) =
+    doAssert false
+
+  proc test(a: AObj) =
+    discard
+
+  let x = AObj()
+  test(x)
diff --git a/tests/misc/t9710.nim b/tests/misc/t9710.nim
new file mode 100644
index 000000000..c65cb7bf4
--- /dev/null
+++ b/tests/misc/t9710.nim
@@ -0,0 +1,6 @@
+discard """
+  matrix: "--debugger:native"
+"""
+# bug #9710
+for i in 1 || 200:
+  discard i