summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/accept/compile/tcan_inherit_generic.nim10
-rw-r--r--tests/accept/compile/tcan_specialise_generic.nim11
-rw-r--r--tests/accept/compile/tspecialised_is_equivalent.nim15
-rw-r--r--tests/accept/run/tmacro4.nim19
4 files changed, 55 insertions, 0 deletions
diff --git a/tests/accept/compile/tcan_inherit_generic.nim b/tests/accept/compile/tcan_inherit_generic.nim
new file mode 100644
index 000000000..fa92c7986
--- /dev/null
+++ b/tests/accept/compile/tcan_inherit_generic.nim
@@ -0,0 +1,10 @@
+##
+## can_inherit_generic Nimrod Module
+##
+## Created by Eric Doughty-Papassideris on 2011-02-16.
+## Copyright (c) 2011 FWA. All rights reserved.
+
+type
+  TGen[T] = object
+  TSpef[T] = object of TGen[T]
+
diff --git a/tests/accept/compile/tcan_specialise_generic.nim b/tests/accept/compile/tcan_specialise_generic.nim
new file mode 100644
index 000000000..f98a8bf95
--- /dev/null
+++ b/tests/accept/compile/tcan_specialise_generic.nim
@@ -0,0 +1,11 @@
+##
+## can_specialise_generic Nimrod Module
+##
+## Created by Eric Doughty-Papassideris on 2011-02-16.
+## Copyright (c) 2011 FWA. All rights reserved.
+
+type
+  TGen[T] = object
+  TSpef = object of TGen[string]
+  
+
diff --git a/tests/accept/compile/tspecialised_is_equivalent.nim b/tests/accept/compile/tspecialised_is_equivalent.nim
new file mode 100644
index 000000000..60b976e90
--- /dev/null
+++ b/tests/accept/compile/tspecialised_is_equivalent.nim
@@ -0,0 +1,15 @@
+##
+## specialised_is_equivalent Nimrod Module
+##
+## Created by Eric Doughty-Papassideris on 2011-02-16.
+## Copyright (c) 2011 FWA. All rights reserved.
+
+type
+  TGen[T] = tuple[a: T]
+  TSpef = tuple[a: string]
+
+var
+  a: TGen[string]
+  b: TSpef
+a = b
+
diff --git a/tests/accept/run/tmacro4.nim b/tests/accept/run/tmacro4.nim
new file mode 100644
index 000000000..f90a8a434
--- /dev/null
+++ b/tests/accept/run/tmacro4.nim
@@ -0,0 +1,19 @@
+discard """
+  output: "after"
+"""
+
+import
+  macros, strutils
+
+macro test_macro*(n: stmt): stmt =
+  result = newNimNode(nnkStmtList)
+  var ass : PNimrodNode = newNimNode(nnkAsgn)
+  add(ass, newIdentNode("str"))
+  add(ass, newStrLitNode("after"))
+  add(result, ass)
+when isMainModule:
+  var str: string = "before"
+  test_macro(str):
+    var i : integer = 123
+  echo str
+