new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
10
tests/ambsym/mambsym1.nim
Normal file
10
tests/ambsym/mambsym1.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import mambsym2 # import TExport
|
||||
|
||||
type
|
||||
TExport* = enum x, y, z
|
||||
TOtherEnum* = enum mDec, mInc, mAssign
|
||||
|
||||
proc ha() =
|
||||
var
|
||||
x: TExport # no error
|
||||
nil
|
||||
3
tests/ambsym/mambsym2.nim
Normal file
3
tests/ambsym/mambsym2.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
type
|
||||
TExport* = enum a, b, c
|
||||
|
||||
7
tests/ambsym/mambsys1.nim
Normal file
7
tests/ambsym/mambsys1.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import mambsys2 # import TExport
|
||||
|
||||
type
|
||||
TExport* = enum x, y, z
|
||||
|
||||
proc foo*(x: int) =
|
||||
nil
|
||||
4
tests/ambsym/mambsys2.nim
Normal file
4
tests/ambsym/mambsys2.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
type
|
||||
TExport* = enum x, y, z # exactly the same type!
|
||||
|
||||
proc foo*(x: int) = nil
|
||||
15
tests/ambsym/tambsym.nim
Normal file
15
tests/ambsym/tambsym.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
discard """
|
||||
file: "tambsym.nim"
|
||||
line: 11
|
||||
errormsg: "ambiguous identifier"
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, mambsym2
|
||||
|
||||
var
|
||||
v: TExport #ERROR_MSG ambiguous identifier
|
||||
|
||||
v = y
|
||||
|
||||
|
||||
24
tests/ambsym/tambsym2.nim
Normal file
24
tests/ambsym/tambsym2.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
discard """
|
||||
file: "tambsym2.nim"
|
||||
output: "7"
|
||||
"""
|
||||
# Test overloading of procs with locals
|
||||
|
||||
type
|
||||
TMyType = object
|
||||
len: int
|
||||
data: string
|
||||
|
||||
proc len(x: TMyType): int {.inline.} = return x.len
|
||||
|
||||
proc x(s: TMyType, len: int) =
|
||||
writeln(stdout, len(s))
|
||||
|
||||
var
|
||||
m: TMyType
|
||||
m.len = 7
|
||||
m.data = "1234"
|
||||
|
||||
x(m, 5) #OUT 7
|
||||
|
||||
|
||||
15
tests/ambsym/tambsym3.nim
Normal file
15
tests/ambsym/tambsym3.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
discard """
|
||||
file: "tambsym3.nim"
|
||||
line: 11
|
||||
errormsg: "ambiguous identifier"
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, times
|
||||
|
||||
var
|
||||
v = mDec #ERROR_MSG ambiguous identifier
|
||||
|
||||
writeln(stdout, ord(v))
|
||||
|
||||
|
||||
13
tests/ambsym/tambsys.nim
Normal file
13
tests/ambsym/tambsys.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
file: "tambsys.nim"
|
||||
output: ""
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsys1, mambsys2
|
||||
|
||||
var
|
||||
v: mambsys1.TExport
|
||||
mambsys2.foo(3) #OUT
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue