tests themselves contain the expected result
This commit is contained in:
parent
cbee9c4e1a
commit
2cdfe35e73
144 changed files with 957 additions and 200 deletions
|
|
@ -1,41 +0,0 @@
|
|||
t99bott.nim;20;constant expression expected
|
||||
tadrdisc.nim;15;for a 'var' type a variable needs to be passed
|
||||
tambsym.nim;6;ambiguous identifier
|
||||
tambsym2.nim;4;undeclared identifier: 'CreateRGBSurface'
|
||||
tambsym3.nim;6;ambiguous identifier
|
||||
tarraycons.nim;9;invalid order in array constructor
|
||||
tatomic.nim;2;identifier expected, but found 'atomic'
|
||||
tbind2.nim;7;ambiguous call
|
||||
tbind4.nim;4;undeclared identifier: 'lastId'
|
||||
tblock1.nim;9;undeclared identifier: 'ha'
|
||||
tconstr1.nim;20;type mismatch
|
||||
tillrec.nim;8;illegal recursion in type 'TIllegal'
|
||||
tinc.nim;3;for a 'var' type a variable needs to be passed
|
||||
tinout.nim;7;for a 'var' type a variable needs to be passed
|
||||
tinvalidnewseq.nim;10;type mismatch: got (array[0..6, string], int)
|
||||
tinvwhen.nim;6;invalid indentation
|
||||
titer4.nim;2;iterator within for loop context expected
|
||||
tmethod.nim;2;'method' needs a parameter that has an object type
|
||||
tnamedparams.nim;3; Error: type mismatch: got (input: string, filename: string, line: int, col: int)
|
||||
tnamspc.nim;5;undeclared identifier: 'global'
|
||||
tnoop.nim;6;expression 'a()' cannot be called
|
||||
tnot.nim;9;type mismatch
|
||||
topaque.nim;11;undeclared field: 'buffer'
|
||||
topena1.nim;4;invalid type
|
||||
toverl.nim;6;attempt to redefine 'TNone'
|
||||
trawstr.nim;5;closing " expected
|
||||
trecinca.nim;3;recursive dependency: 'tests/reject/trecincb.nim'
|
||||
trecincb.nim;4;recursive dependency: 'tests/reject/trecincb.nim'
|
||||
treciter.nim;4;recursive dependency: 'myrec'
|
||||
trectype.nim;20;internal error: cannot generate C type for: PA
|
||||
trefs.nim;15;type mismatch
|
||||
tsidee1.nim;7;'SideEffectLyer' can have side effects
|
||||
tsidee4.nim;10;type mismatch
|
||||
tsimtych.nim;5;type mismatch: got (bool) but expected 'string'
|
||||
tstatret.nim;4;statement not allowed after
|
||||
tstmtexp.nim;3;value returned by statement has to be discarded
|
||||
ttempl2.nim;13;undeclared identifier: 'b'
|
||||
ttypelessemptyset.nim;0;Error: internal error: invalid kind for last(tyEmpty)
|
||||
tunderscores.nim;3;invalid token: _
|
||||
twrongtupleaccess.nim;4;undeclared field: 'setBLAH'
|
||||
typredef.nim;2;illegal recursion in type 'Uint8'
|
||||
|
Can't render this file because it contains an unexpected character in line 26 and column 23.
|
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "t99bott.nim"
|
||||
line: 25
|
||||
errormsg: "constant expression expected"
|
||||
"""
|
||||
## 99 Bottles of Beer
|
||||
## http://www.99-bottles-of-beer.net/
|
||||
## Nimrod version
|
||||
|
|
@ -26,3 +31,5 @@ echo "No more bottles of beer on the wall, no more bottles of beer."
|
|||
echo "Go to the store and buy some more, 99 bottles of beer on the wall."
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tadrdisc.nim"
|
||||
line: 20
|
||||
errormsg: "for a \'var\' type a variable needs to be passed"
|
||||
"""
|
||||
# Test that the address of a dicriminants cannot be taken
|
||||
|
||||
type
|
||||
|
|
@ -14,3 +19,5 @@ proc setKind(k: var TKind) =
|
|||
var a: TA
|
||||
setKind(a.k) #ERROR_MSG for a 'var' type a variable needs to be passed
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tambsym.nim"
|
||||
line: 11
|
||||
errormsg: "ambiguous identifier"
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, mambsym2
|
||||
|
|
@ -6,3 +11,5 @@ var
|
|||
v: TExport #ERROR_MSG ambiguous identifier
|
||||
|
||||
v = y
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
discard """
|
||||
file: "tambsym2.nim"
|
||||
line: 9
|
||||
errormsg: "undeclared identifier: \'CreateRGBSurface\'"
|
||||
"""
|
||||
|
||||
from sdl import PSurface
|
||||
|
||||
discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34,
|
||||
32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tambsym3.nim"
|
||||
line: 11
|
||||
errormsg: "ambiguous identifier"
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, times
|
||||
|
|
@ -6,3 +11,5 @@ var
|
|||
v = mDec #ERROR_MSG ambiguous identifier
|
||||
|
||||
writeln(stdout, ord(v))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tarraycons.nim"
|
||||
line: 14
|
||||
errormsg: "invalid order in array constructor"
|
||||
"""
|
||||
|
||||
type
|
||||
TEnum = enum
|
||||
|
|
@ -15,3 +20,5 @@ const
|
|||
|
||||
echo myMapping[eC][1]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "tatomic.nim"
|
||||
line: 7
|
||||
errormsg: "identifier expected, but found \'atomic\'"
|
||||
"""
|
||||
var
|
||||
atomic: int
|
||||
|
||||
echo atomic
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tbind2.nim"
|
||||
line: 12
|
||||
errormsg: "ambiguous call"
|
||||
"""
|
||||
# Test the new ``bind`` keyword for templates
|
||||
|
||||
proc p1(x: int8, y: int): int = return x + y
|
||||
|
|
@ -8,3 +13,5 @@ template tempBind(x, y: expr): expr =
|
|||
|
||||
echo tempBind(1'i8, 2'i8)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
discard """
|
||||
file: "tbind4.nim"
|
||||
line: 9
|
||||
errormsg: "undeclared identifier: \'lastId\'"
|
||||
"""
|
||||
# Module B
|
||||
import mbind4
|
||||
|
||||
echo genId() #ERROR_MSG instantiation from here
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tblock1.nim"
|
||||
line: 14
|
||||
errormsg: "undeclared identifier: \'ha\'"
|
||||
"""
|
||||
# check for forward label and
|
||||
# for failure when label is not declared
|
||||
|
||||
|
|
@ -9,3 +14,5 @@ proc main =
|
|||
break ha #ERROR
|
||||
|
||||
main()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tconstr1.nim"
|
||||
line: 25
|
||||
errormsg: "type mismatch"
|
||||
"""
|
||||
# Test array, record constructors
|
||||
|
||||
type
|
||||
|
|
@ -21,3 +26,5 @@ const
|
|||
otherThings = [ # the same
|
||||
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
|
||||
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tillrec.nim"
|
||||
line: 13
|
||||
errormsg: "illegal recursion in type \'TIllegal\'"
|
||||
"""
|
||||
# test illegal recursive types
|
||||
|
||||
type
|
||||
|
|
@ -8,3 +13,5 @@ type
|
|||
TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal'
|
||||
y: Int
|
||||
x: array[0..3, TIllegal]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "tinc.nim"
|
||||
line: 8
|
||||
errormsg: "for a \'var\' type a variable needs to be passed"
|
||||
"""
|
||||
var x = 0
|
||||
|
||||
inc(x+1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tinout.nim"
|
||||
line: 12
|
||||
errormsg: "for a \'var\' type a variable needs to be passed"
|
||||
"""
|
||||
# Test in out checking for parameters
|
||||
|
||||
proc abc(x: var int) =
|
||||
|
|
@ -7,3 +12,5 @@ proc b() =
|
|||
abc(3) #ERROR
|
||||
|
||||
b()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tinvalidnewseq.nim"
|
||||
line: 15
|
||||
errormsg: "type mismatch: got (array[0..6, string], int)"
|
||||
"""
|
||||
import re, strutils
|
||||
|
||||
type
|
||||
|
|
@ -18,3 +23,5 @@ var r: TUrl
|
|||
r = parseUrl(r"http://google.com/search?var=bleahdhsad")
|
||||
echo(r.domain)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tinvwhen.nim"
|
||||
line: 11
|
||||
errormsg: "invalid indentation"
|
||||
"""
|
||||
# This was parsed even though it should not!
|
||||
|
||||
proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".}
|
||||
|
|
@ -6,3 +11,5 @@ proc getcwd(buf: CString, buflen: cint): CString
|
|||
when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation
|
||||
elif defined(windows): {.importc: "getcwd", header: "<direct.h>"}
|
||||
else: {.error: "os library not ported to your OS. Please help!".}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
discard """
|
||||
file: "titer4.nim"
|
||||
line: 7
|
||||
errormsg: "iterator within for loop context expected"
|
||||
"""
|
||||
|
||||
for x in {'a'..'z'}: #ERROR_MSG iterator within for loop context expected
|
||||
nil
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
discard """
|
||||
file: "tmethod.nim"
|
||||
line: 7
|
||||
errormsg: "\'method\' needs a parameter that has an object type"
|
||||
"""
|
||||
|
||||
method m(i: int): int =
|
||||
return 5
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tnamedparams.nim"
|
||||
line: 8
|
||||
errormsg: "Error: type mismatch: got (input: string, filename: string, line: int, col: int)"
|
||||
"""
|
||||
import pegs
|
||||
|
||||
discard parsePeg(
|
||||
|
|
@ -6,3 +11,5 @@ discard parsePeg(
|
|||
line = 1,
|
||||
col = 23)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "tnamspc.nim"
|
||||
line: 10
|
||||
errormsg: "undeclared identifier: \'global\'"
|
||||
"""
|
||||
# Test17 - test correct handling of namespaces
|
||||
|
||||
import mnamspc1
|
||||
|
||||
global = 9 #ERROR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
discard """
|
||||
file: "tnoop.nim"
|
||||
line: 11
|
||||
errormsg: "expression \'a()\' cannot be called"
|
||||
"""
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tnot.nim"
|
||||
line: 14
|
||||
errormsg: "type mismatch"
|
||||
"""
|
||||
# BUG: following compiles, but should not:
|
||||
|
||||
proc nodeOfDegree(x: Int): bool =
|
||||
|
|
@ -13,3 +18,5 @@ proc main =
|
|||
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "topaque.nim"
|
||||
line: 16
|
||||
errormsg: "undeclared field: \'buffer\'"
|
||||
"""
|
||||
# Test the new opaque types
|
||||
|
||||
import
|
||||
|
|
@ -9,3 +14,5 @@ var
|
|||
L.filename = "ha"
|
||||
L.line = 34
|
||||
L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "topena1.nim"
|
||||
line: 9
|
||||
errormsg: "invalid type"
|
||||
"""
|
||||
# Tests a special bug
|
||||
|
||||
var
|
||||
x: ref openarray[string] #ERROR_MSG invalid type
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
discard """
|
||||
file: "toverl.nim"
|
||||
line: 11
|
||||
errormsg: "attempt to redefine \'TNone\'"
|
||||
"""
|
||||
# Test for overloading
|
||||
|
||||
type
|
||||
TNone {.exportc: "_NONE", final.} = object
|
||||
|
||||
proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "trawstr.nim"
|
||||
line: 10
|
||||
errormsg: "closing \" expected"
|
||||
"""
|
||||
# Test the new raw strings:
|
||||
|
||||
const
|
||||
xxx = r"This is a raw string!"
|
||||
yyy = "This not\" #ERROR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "trecinca.nim"
|
||||
line: 8
|
||||
errormsg: "recursive dependency: \'tests/reject/trecincb.nim\'"
|
||||
"""
|
||||
# Test recursive includes
|
||||
|
||||
include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim'
|
||||
|
||||
echo "trecina"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
discard """
|
||||
file: "trecincb.nim"
|
||||
line: 9
|
||||
errormsg: "recursive dependency: \'tests/reject/trecincb.nim\'"
|
||||
"""
|
||||
# Test recursive includes
|
||||
|
||||
|
||||
include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim'
|
||||
|
||||
echo "trecinb"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "treciter.nim"
|
||||
line: 9
|
||||
errormsg: "recursive dependency: \'myrec\'"
|
||||
"""
|
||||
# Test that an error message occurs for a recursive iterator
|
||||
|
||||
iterator myrec(n: int): int =
|
||||
|
|
@ -5,3 +10,5 @@ iterator myrec(n: int): int =
|
|||
yield x
|
||||
|
||||
for x in myrec(10): echo x
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "trectype.nim"
|
||||
line: 25
|
||||
errormsg: "internal error: cannot generate C type for: PA"
|
||||
"""
|
||||
# Test recursive type descriptions
|
||||
# (mainly for the C code generator)
|
||||
|
||||
|
|
@ -19,3 +24,5 @@ var
|
|||
new(x)
|
||||
#ERROR_MSG internal error: cannot generate C type for: PA
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "trefs.nim"
|
||||
line: 20
|
||||
errormsg: "type mismatch"
|
||||
"""
|
||||
# test for ref types (including refs to procs)
|
||||
|
||||
type
|
||||
|
|
@ -14,3 +19,5 @@ p = foo
|
|||
write(stdout, "success!")
|
||||
p = wrongfoo #ERROR_MSG type mismatch
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tsidee1.nim"
|
||||
line: 12
|
||||
errormsg: "\'SideEffectLyer\' can have side effects"
|
||||
"""
|
||||
|
||||
var
|
||||
global: int
|
||||
|
|
@ -9,3 +14,5 @@ proc SideEffectLyer(x, y: int): int {.noSideEffect.} = #ERROR_MSG 'SideEffectLye
|
|||
|
||||
echo SideEffectLyer(1, 3)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tsidee4.nim"
|
||||
line: 15
|
||||
errormsg: "type mismatch"
|
||||
"""
|
||||
|
||||
var
|
||||
global: int
|
||||
|
|
@ -8,3 +13,5 @@ proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSi
|
|||
return x + y + dontcare(x)
|
||||
|
||||
echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "tsimtych.nim"
|
||||
line: 10
|
||||
errormsg: "type mismatch: got (bool) but expected \'string\'"
|
||||
"""
|
||||
# Test 2
|
||||
# Simple type checking
|
||||
|
||||
var a: string
|
||||
a = false #ERROR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "tstatret.nim"
|
||||
line: 9
|
||||
errormsg: "statement not allowed after"
|
||||
"""
|
||||
# no statement after return
|
||||
proc main() =
|
||||
return
|
||||
echo("huch?") #ERROR_MSG statement not allowed after
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
discard """
|
||||
file: "tstmtexp.nim"
|
||||
line: 8
|
||||
errormsg: "value returned by statement has to be discarded"
|
||||
"""
|
||||
# Test 3
|
||||
|
||||
1+4 #ERROR_MSG value returned by statement has to be discarded
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "ttempl2.nim"
|
||||
line: 18
|
||||
errormsg: "undeclared identifier: \'b\'"
|
||||
"""
|
||||
template declareInScope(x: expr, t: typeDesc): stmt =
|
||||
var x: t
|
||||
|
||||
|
|
@ -12,3 +17,5 @@ a = 42 # works, `a` is known here
|
|||
declareInNewScope(b, int)
|
||||
b = 42 #ERROR_MSG undeclared identifier: 'b'
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
discard """
|
||||
file: "ttypelessemptyset.nim"
|
||||
line: 5
|
||||
errormsg: "Error: internal error: invalid kind for last(tyEmpty)"
|
||||
"""
|
||||
var q = false
|
||||
discard (if q: {} else: {})
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
discard """
|
||||
file: "tunderscores.nim"
|
||||
line: 8
|
||||
errormsg: "invalid token: _"
|
||||
"""
|
||||
# Bug #502670
|
||||
|
||||
var ef_ = 3 #ERROR_MSG invalid token: _
|
||||
|
|
@ -5,3 +10,5 @@ var a__b = 1
|
|||
var c___d = 2
|
||||
echo(ab, cd, ef_)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
discard """
|
||||
file: "twrongtupleaccess.nim"
|
||||
line: 9
|
||||
errormsg: "undeclared field: \'setBLAH\'"
|
||||
"""
|
||||
# Bugfix
|
||||
|
||||
var v = (5.0, 10.0)
|
||||
v.setBLAH(10)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
discard """
|
||||
file: "typredef.nim"
|
||||
line: 7
|
||||
errormsg: "illegal recursion in type \'Uint8\'"
|
||||
"""
|
||||
type
|
||||
Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8'
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue