summary refs log tree commit diff stats
path: root/tests/constr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/constr')
-rw-r--r--tests/constr/a_module.nim6
-rw-r--r--tests/constr/tconexpr.nim43
-rw-r--r--tests/constr/tconstr1.nim28
-rw-r--r--tests/constr/tconstr2.nim22
-rw-r--r--tests/constr/tglobal.nim7
-rw-r--r--tests/constr/tnocompiletimefunc.nim14
-rw-r--r--tests/constr/tnocompiletimefunclambda.nim6
7 files changed, 0 insertions, 126 deletions
diff --git a/tests/constr/a_module.nim b/tests/constr/a_module.nim
deleted file mode 100644
index 1d3f4848c..000000000
--- a/tests/constr/a_module.nim
+++ /dev/null
@@ -1,6 +0,0 @@
-# a.nim
-{.push stackTrace: off.}
-proc foo*(): int =
-  var a {.global.} = 0
-  result = a
-{.pop.}
\ No newline at end of file
diff --git a/tests/constr/tconexpr.nim b/tests/constr/tconexpr.nim
deleted file mode 100644
index cca6dd84f..000000000
--- a/tests/constr/tconexpr.nim
+++ /dev/null
@@ -1,43 +0,0 @@
-discard """
-  nimout: '''
-Fibonacci sequence: 0, 1, 1, 2, 3
-Sequence continues: 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610
-'''
-"""
-
-
-import strformat
-
-var fib_n {.compileTime.}: int
-var fib_prev {.compileTime.}: int
-var fib_prev_prev {.compileTime.}: int
-
-proc next_fib(): int {.compileTime.} =
-  let fib = if fib_n < 2:
-    fib_n
-  else:
-    fib_prev_prev + fib_prev
-  inc(fib_n)
-  fib_prev_prev = fib_prev
-  fib_prev = fib
-  fib
-
-const f0 = next_fib()
-const f1 = next_fib()
-const f2 = next_fib()
-const f3 = next_fib()
-const f4 = next_fib()
-
-static:
-  echo fmt"Fibonacci sequence: {f0}, {f1}, {f2}, {f3}, {f4}"
-
-const fib_continues = block:
-  var result = fmt"Sequence continues: "
-  for i in 0..10:
-    if i > 0:
-      add(result, ", ")
-    add(result, $next_fib())
-  result
-
-static:
-  echo fib_continues
\ No newline at end of file
diff --git a/tests/constr/tconstr1.nim b/tests/constr/tconstr1.nim
deleted file mode 100644
index a169bf453..000000000
--- a/tests/constr/tconstr1.nim
+++ /dev/null
@@ -1,28 +0,0 @@
-discard """
-  errormsg: "type mismatch"
-  file: "tconstr1.nim"
-  line: 25
-"""
-# Test array, record constructors
-
-type
-  TComplexRecord = tuple[
-    s: string,
-    x, y: int,
-    z: float,
-    chars: set[char]]
-
-proc testSem =
-  var
-    things: array[0..1, TComplexRecord] = [
-      (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
-      (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})]
-  write(stdout, things[0].x)
-
-const
-  things: array[0..1, TComplexRecord] = [
-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
-    (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR
-  otherThings = [  # the same
-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
diff --git a/tests/constr/tconstr2.nim b/tests/constr/tconstr2.nim
deleted file mode 100644
index 2557d7db9..000000000
--- a/tests/constr/tconstr2.nim
+++ /dev/null
@@ -1,22 +0,0 @@
-discard """
-  output: "69"
-"""
-# Test array, record constructors
-
-type
-  TComplexRecord = tuple[
-    s: string,
-    x, y: int,
-    z: float,
-    chars: set[char]]
-
-const
-  things: array[0..1, TComplexRecord] = [
-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})]
-  otherThings = [  # the same
-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
-
-writeLine(stdout, things[0].x)
-#OUT 69
diff --git a/tests/constr/tglobal.nim b/tests/constr/tglobal.nim
deleted file mode 100644
index 056ac9f81..000000000
--- a/tests/constr/tglobal.nim
+++ /dev/null
@@ -1,7 +0,0 @@
-discard """
-output: "0"
-"""
-
-# b.nim
-import a_module
-echo foo()
\ No newline at end of file
diff --git a/tests/constr/tnocompiletimefunc.nim b/tests/constr/tnocompiletimefunc.nim
deleted file mode 100644
index a95648c0f..000000000
--- a/tests/constr/tnocompiletimefunc.nim
+++ /dev/null
@@ -1,14 +0,0 @@
-discard """
-  errormsg: "request to generate code for .compileTime proc: foo"
-"""
-
-# ensure compileTime funcs can't be called from runtime
-
-func foo(a: int): int {.compileTime.} =
-  a * a
-
-proc doAThing(): int =
-  for i in 0..2:
-    result += foo(i)
-
-echo doAThing()
diff --git a/tests/constr/tnocompiletimefunclambda.nim b/tests/constr/tnocompiletimefunclambda.nim
deleted file mode 100644
index d134eea40..000000000
--- a/tests/constr/tnocompiletimefunclambda.nim
+++ /dev/null
@@ -1,6 +0,0 @@
-discard """
-  errormsg: "request to generate code for .compileTime proc: :anonymous"
-"""
-
-let a = func(a: varargs[int]) {.compileTime, closure.} =
-  discard a[0]
\ No newline at end of file