diff options
author | Araq <rumpf_a@web.de> | 2015-02-09 12:42:00 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-02-10 20:19:45 +0100 |
commit | 247af96b00ae4d995bb668504e10d135fa95506d (patch) | |
tree | 880e186a87fb658c77c78c6df18bfdfc8c1d11ad /tests/modules | |
parent | 3a8f7d505b3ddfe724af4237516b1ce46c533758 (diff) | |
download | Nim-247af96b00ae4d995bb668504e10d135fa95506d.tar.gz |
cleaned up some tests
Diffstat (limited to 'tests/modules')
-rw-r--r-- | tests/modules/mnamspc1.nim | 2 | ||||
-rw-r--r-- | tests/modules/mnamspc2.nim | 3 | ||||
-rw-r--r-- | tests/modules/mopaque.nim | 7 | ||||
-rw-r--r-- | tests/modules/mrecmod.nim | 1 | ||||
-rw-r--r-- | tests/modules/mrecmod2.nim | 9 | ||||
-rw-r--r-- | tests/modules/tnamspc.nim | 12 | ||||
-rw-r--r-- | tests/modules/topaque.nim | 18 | ||||
-rw-r--r-- | tests/modules/trecinca.nim | 12 | ||||
-rw-r--r-- | tests/modules/trecincb.nim | 13 | ||||
-rw-r--r-- | tests/modules/trecmod.nim | 2 | ||||
-rw-r--r-- | tests/modules/trecmod2.nim | 10 |
11 files changed, 89 insertions, 0 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/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..bedea8d7e --- /dev/null +++ b/tests/modules/trecinca.nim @@ -0,0 +1,12 @@ +discard """ + file: "tests/reject/trecincb.nim" + line: 9 + errormsg: "recursive dependency: 'trecincb.nim'" +""" +# Test recursive includes + +include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim' + +echo "trecina" + + diff --git a/tests/modules/trecincb.nim b/tests/modules/trecincb.nim new file mode 100644 index 000000000..eb0f72db0 --- /dev/null +++ b/tests/modules/trecincb.nim @@ -0,0 +1,13 @@ +discard """ + file: "trecincb.nim" + line: 9 + errormsg: "recursive dependency: 'trecincb.nim'" +""" +# Test recursive includes + + +include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim' + +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() + |