summary refs log tree commit diff stats
path: root/tests/modules
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/mnamspc1.nim2
-rw-r--r--tests/modules/mnamspc2.nim3
-rw-r--r--tests/modules/mopaque.nim7
-rw-r--r--tests/modules/mrecmod.nim1
-rw-r--r--tests/modules/mrecmod2.nim9
-rw-r--r--tests/modules/tmismatchedvisibility.nim4
-rw-r--r--tests/modules/tnamspc.nim12
-rw-r--r--tests/modules/topaque.nim18
-rw-r--r--tests/modules/trecinca.nim12
-rw-r--r--tests/modules/trecincb.nim13
-rw-r--r--tests/modules/trecmod.nim2
-rw-r--r--tests/modules/trecmod2.nim10
12 files changed, 91 insertions, 2 deletions
diff --git a/tests/modules/mnamspc1.nim b/tests/modules/mnamspc1.nim
new file mode 100644
index 000000000..da13c5f24
--- /dev/null
+++ b/tests/modules/mnamspc1.nim
@@ -0,0 +1,2 @@
+import mnamspc2

+

diff --git a/tests/modules/mnamspc2.nim b/tests/modules/mnamspc2.nim
new file mode 100644
index 000000000..84ef8533e
--- /dev/null
+++ b/tests/modules/mnamspc2.nim
@@ -0,0 +1,3 @@
+# export an identifier:

+var

+  global*: int

diff --git a/tests/modules/mopaque.nim b/tests/modules/mopaque.nim
new file mode 100644
index 000000000..7eee4bd96
--- /dev/null
+++ b/tests/modules/mopaque.nim
@@ -0,0 +1,7 @@
+type

+  TLexer* {.final.} = object

+    line*: int

+    filename*: string

+    buffer: cstring

+
+proc noProcVar*(): int = 18
diff --git a/tests/modules/mrecmod.nim b/tests/modules/mrecmod.nim
new file mode 100644
index 000000000..fab9654d5
--- /dev/null
+++ b/tests/modules/mrecmod.nim
@@ -0,0 +1 @@
+import trecmod

diff --git a/tests/modules/mrecmod2.nim b/tests/modules/mrecmod2.nim
new file mode 100644
index 000000000..9557ce729
--- /dev/null
+++ b/tests/modules/mrecmod2.nim
@@ -0,0 +1,9 @@
+# Module B
+import trecmod2  
+
+proc p*(x: trecmod2.T1): trecmod2.T1 =
+  # this works because the compiler has already
+  # added T1 to trecmod2's interface symbol table
+  return x + 1
+  
+
diff --git a/tests/modules/tmismatchedvisibility.nim b/tests/modules/tmismatchedvisibility.nim
index 6f2f79282..325c729c0 100644
--- a/tests/modules/tmismatchedvisibility.nim
+++ b/tests/modules/tmismatchedvisibility.nim
@@ -1,9 +1,9 @@
 discard """
   line: 8
-  errormsg: "public implementation 'tmismatchedvisibility.foo(a: int): int' has non-public forward declaration in tmismatchedvisibility.nim(6,5)"
+  errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)' has non-public forward declaration in "
 """
 
 proc foo(a: int): int
 
 proc foo*(a: int): int =
-  result = a + a
\ No newline at end of file
+  result = a + a
diff --git a/tests/modules/tnamspc.nim b/tests/modules/tnamspc.nim
new file mode 100644
index 000000000..1e2049cec
--- /dev/null
+++ b/tests/modules/tnamspc.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tnamspc.nim"
+  line: 10
+  errormsg: "undeclared identifier: \'global\'"
+"""
+# Test17 - test correct handling of namespaces

+

+import mnamspc1

+

+global = 9 #ERROR

+
+
diff --git a/tests/modules/topaque.nim b/tests/modules/topaque.nim
new file mode 100644
index 000000000..f0587c959
--- /dev/null
+++ b/tests/modules/topaque.nim
@@ -0,0 +1,18 @@
+discard """
+  file: "topaque.nim"
+  line: 16
+  errormsg: "undeclared identifier: \'buffer\'"
+"""
+# Test the new opaque types
+
+import 
+  mopaque
+  
+var
+  L: TLexer
+  
+L.filename = "ha"
+L.line = 34
+L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
+
+
diff --git a/tests/modules/trecinca.nim b/tests/modules/trecinca.nim
new file mode 100644
index 000000000..14a91ba5c
--- /dev/null
+++ b/tests/modules/trecinca.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tests/reject/trecincb.nim"
+  line: 9
+  errormsg: "recursive dependency: 'tests/modules/trecincb.nim'"
+"""
+# Test recursive includes
+
+include trecincb
+
+echo "trecina"
+
+
diff --git a/tests/modules/trecincb.nim b/tests/modules/trecincb.nim
new file mode 100644
index 000000000..299a242e1
--- /dev/null
+++ b/tests/modules/trecincb.nim
@@ -0,0 +1,13 @@
+discard """
+  file: "trecincb.nim"
+  line: 9
+  errormsg: "recursive dependency: 'tests/modules/trecincb.nim'"
+"""
+# Test recursive includes
+
+
+include trecincb
+
+echo "trecinb"
+
+
diff --git a/tests/modules/trecmod.nim b/tests/modules/trecmod.nim
new file mode 100644
index 000000000..9d39d3ff7
--- /dev/null
+++ b/tests/modules/trecmod.nim
@@ -0,0 +1,2 @@
+# recursive module

+import mrecmod

diff --git a/tests/modules/trecmod2.nim b/tests/modules/trecmod2.nim
new file mode 100644
index 000000000..85fe2215f
--- /dev/null
+++ b/tests/modules/trecmod2.nim
@@ -0,0 +1,10 @@
+type
+  T1* = int  # Module A exports the type ``T1``
+
+import mrecmod2   # the compiler starts parsing B
+
+proc main() =
+  var i = p(3) # works because B has been parsed completely here
+
+main()
+