mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
cleaned up some tests
This commit is contained in:
2
tests/modules/mnamspc1.nim
Normal file
2
tests/modules/mnamspc1.nim
Normal file
@@ -0,0 +1,2 @@
|
||||
import mnamspc2
|
||||
|
||||
3
tests/modules/mnamspc2.nim
Normal file
3
tests/modules/mnamspc2.nim
Normal file
@@ -0,0 +1,3 @@
|
||||
# export an identifier:
|
||||
var
|
||||
global*: int
|
||||
7
tests/modules/mopaque.nim
Normal file
7
tests/modules/mopaque.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
type
|
||||
TLexer* {.final.} = object
|
||||
line*: int
|
||||
filename*: string
|
||||
buffer: cstring
|
||||
|
||||
proc noProcVar*(): int = 18
|
||||
1
tests/modules/mrecmod.nim
Normal file
1
tests/modules/mrecmod.nim
Normal file
@@ -0,0 +1 @@
|
||||
import trecmod
|
||||
9
tests/modules/mrecmod2.nim
Normal file
9
tests/modules/mrecmod2.nim
Normal file
@@ -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
|
||||
|
||||
|
||||
12
tests/modules/tnamspc.nim
Normal file
12
tests/modules/tnamspc.nim
Normal file
@@ -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
|
||||
|
||||
|
||||
18
tests/modules/topaque.nim
Normal file
18
tests/modules/topaque.nim
Normal file
@@ -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'
|
||||
|
||||
|
||||
12
tests/modules/trecinca.nim
Normal file
12
tests/modules/trecinca.nim
Normal file
@@ -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"
|
||||
|
||||
|
||||
13
tests/modules/trecincb.nim
Normal file
13
tests/modules/trecincb.nim
Normal file
@@ -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"
|
||||
|
||||
|
||||
2
tests/modules/trecmod.nim
Normal file
2
tests/modules/trecmod.nim
Normal file
@@ -0,0 +1,2 @@
|
||||
# recursive module
|
||||
import mrecmod
|
||||
10
tests/modules/trecmod2.nim
Normal file
10
tests/modules/trecmod2.nim
Normal file
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user