cleaned up some tests

This commit is contained in:
Araq
2015-02-09 12:42:00 +01:00
parent 3a8f7d505b
commit 247af96b00
25 changed files with 19 additions and 8 deletions

View File

@@ -0,0 +1,2 @@
import mnamspc2

View File

@@ -0,0 +1,3 @@
# export an identifier:
var
global*: int

View File

@@ -0,0 +1,7 @@
type
TLexer* {.final.} = object
line*: int
filename*: string
buffer: cstring
proc noProcVar*(): int = 18

View File

@@ -0,0 +1 @@
import trecmod

View 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
View 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
View 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'

View 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"

View 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"

View File

@@ -0,0 +1,2 @@
# recursive module
import mrecmod

View 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()