diff options
Diffstat (limited to 'tests/reject')
42 files changed, 287 insertions, 41 deletions
diff --git a/tests/reject/spec.csv b/tests/reject/spec.csv deleted file mode 100755 index f2d38f03b..000000000 --- a/tests/reject/spec.csv +++ /dev/null @@ -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' diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim index 4dfb11701..b514b49d9 100755 --- a/tests/reject/t99bott.nim +++ b/tests/reject/t99bott.nim @@ -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." + + diff --git a/tests/reject/tadrdisc.nim b/tests/reject/tadrdisc.nim index a7118455f..0e0324562 100755 --- a/tests/reject/tadrdisc.nim +++ b/tests/reject/tadrdisc.nim @@ -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 + + diff --git a/tests/reject/tambsym.nim b/tests/reject/tambsym.nim index b8eae3ba3..902274648 100755 --- a/tests/reject/tambsym.nim +++ b/tests/reject/tambsym.nim @@ -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 + + diff --git a/tests/reject/tambsym2.nim b/tests/reject/tambsym2.nim index 3318f3fe2..98327354d 100755 --- a/tests/reject/tambsym2.nim +++ b/tests/reject/tambsym2.nim @@ -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) + + diff --git a/tests/reject/tambsym3.nim b/tests/reject/tambsym3.nim index 96a5098c9..0155f258c 100755 --- a/tests/reject/tambsym3.nim +++ b/tests/reject/tambsym3.nim @@ -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)) + + diff --git a/tests/reject/tarraycons.nim b/tests/reject/tarraycons.nim index 1809f8735..7de518b6e 100755 --- a/tests/reject/tarraycons.nim +++ b/tests/reject/tarraycons.nim @@ -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] + + diff --git a/tests/reject/tatomic.nim b/tests/reject/tatomic.nim index 0f1b8125d..bc119c3b3 100755 --- a/tests/reject/tatomic.nim +++ b/tests/reject/tatomic.nim @@ -1,5 +1,12 @@ +discard """ + file: "tatomic.nim" + line: 7 + errormsg: "identifier expected, but found \'atomic\'" +""" var atomic: int echo atomic + + diff --git a/tests/reject/tbind2.nim b/tests/reject/tbind2.nim index 41711083f..06065538e 100755 --- a/tests/reject/tbind2.nim +++ b/tests/reject/tbind2.nim @@ -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) + + diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim index d0b5fc062..ae525f06e 100755 --- a/tests/reject/tbind4.nim +++ b/tests/reject/tbind4.nim @@ -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 + + diff --git a/tests/reject/tblock1.nim b/tests/reject/tblock1.nim index 0bea7ae7f..5c41aaf82 100755 --- a/tests/reject/tblock1.nim +++ b/tests/reject/tblock1.nim @@ -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() + + diff --git a/tests/reject/tconstr1.nim b/tests/reject/tconstr1.nim index 488170350..cb6594213 100755 --- a/tests/reject/tconstr1.nim +++ b/tests/reject/tconstr1.nim @@ -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'})] + + diff --git a/tests/reject/tillrec.nim b/tests/reject/tillrec.nim index 21ce19889..3f8fe60fc 100755 --- a/tests/reject/tillrec.nim +++ b/tests/reject/tillrec.nim @@ -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] + + diff --git a/tests/reject/tinc.nim b/tests/reject/tinc.nim index 26fe32a41..8038a2a01 100755 --- a/tests/reject/tinc.nim +++ b/tests/reject/tinc.nim @@ -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) + + diff --git a/tests/reject/tinout.nim b/tests/reject/tinout.nim index b4fe2fb10..034c496f5 100755 --- a/tests/reject/tinout.nim +++ b/tests/reject/tinout.nim @@ -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() + + diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim index ccd327284..a8cc36783 100755 --- a/tests/reject/tinvalidnewseq.nim +++ b/tests/reject/tinvalidnewseq.nim @@ -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) + + diff --git a/tests/reject/tinvwhen.nim b/tests/reject/tinvwhen.nim index 8dc8cbf50..ea8a7ddf0 100755 --- a/tests/reject/tinvwhen.nim +++ b/tests/reject/tinvwhen.nim @@ -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!".} + + diff --git a/tests/reject/titer4.nim b/tests/reject/titer4.nim index 376522482..d9d885543 100755 --- a/tests/reject/titer4.nim +++ b/tests/reject/titer4.nim @@ -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 + + diff --git a/tests/reject/tmethod.nim b/tests/reject/tmethod.nim index 101cabf25..999016072 100755 --- a/tests/reject/tmethod.nim +++ b/tests/reject/tmethod.nim @@ -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 + + diff --git a/tests/reject/tnamedparams.nim b/tests/reject/tnamedparams.nim index 6c59518b3..1772bd938 100755 --- a/tests/reject/tnamedparams.nim +++ b/tests/reject/tnamedparams.nim @@ -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) + + diff --git a/tests/reject/tnamspc.nim b/tests/reject/tnamspc.nim index eddaacfd8..1e2049cec 100755 --- a/tests/reject/tnamspc.nim +++ b/tests/reject/tnamspc.nim @@ -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 + + diff --git a/tests/reject/tnoop.nim b/tests/reject/tnoop.nim index d097553e8..2d320c849 100755 --- a/tests/reject/tnoop.nim +++ b/tests/reject/tnoop.nim @@ -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 + + diff --git a/tests/reject/tnot.nim b/tests/reject/tnot.nim index cda551654..cd0f538e6 100755 --- a/tests/reject/tnot.nim +++ b/tests/reject/tnot.nim @@ -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() + + diff --git a/tests/reject/topaque.nim b/tests/reject/topaque.nim index 7553a749e..ac390835b 100755 --- a/tests/reject/topaque.nim +++ b/tests/reject/topaque.nim @@ -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' + + diff --git a/tests/reject/topena1.nim b/tests/reject/topena1.nim index 7351edf55..0dbc5506a 100755 --- a/tests/reject/topena1.nim +++ b/tests/reject/topena1.nim @@ -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 + + diff --git a/tests/reject/toverl.nim b/tests/reject/toverl.nim index 94f251cac..5c5f8d440 100755 --- a/tests/reject/toverl.nim +++ b/tests/reject/toverl.nim @@ -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' + + diff --git a/tests/reject/trawstr.nim b/tests/reject/trawstr.nim index 7b2db0335..ab2aae159 100755 --- a/tests/reject/trawstr.nim +++ b/tests/reject/trawstr.nim @@ -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 + + diff --git a/tests/reject/trecinca.nim b/tests/reject/trecinca.nim index d78fee233..a567c84db 100755 --- a/tests/reject/trecinca.nim +++ b/tests/reject/trecinca.nim @@ -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" + + diff --git a/tests/reject/trecincb.nim b/tests/reject/trecincb.nim index 6191671a1..937c5e488 100755 --- a/tests/reject/trecincb.nim +++ b/tests/reject/trecincb.nim @@ -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" + + diff --git a/tests/reject/treciter.nim b/tests/reject/treciter.nim index 662239285..dacdbdfd7 100755 --- a/tests/reject/treciter.nim +++ b/tests/reject/treciter.nim @@ -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 + + diff --git a/tests/reject/trectype.nim b/tests/reject/trectype.nim index a7a6f56e0..e9bf8234d 100755 --- a/tests/reject/trectype.nim +++ b/tests/reject/trectype.nim @@ -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 + + diff --git a/tests/reject/trefs.nim b/tests/reject/trefs.nim index ab3934088..b157ca2b5 100755 --- a/tests/reject/trefs.nim +++ b/tests/reject/trefs.nim @@ -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 + + diff --git a/tests/reject/tsidee1.nim b/tests/reject/tsidee1.nim index 3bd520680..bd5b32dd7 100755 --- a/tests/reject/tsidee1.nim +++ b/tests/reject/tsidee1.nim @@ -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) + + diff --git a/tests/reject/tsidee4.nim b/tests/reject/tsidee4.nim index 55c474d10..cbebfbd36 100755 --- a/tests/reject/tsidee4.nim +++ b/tests/reject/tsidee4.nim @@ -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 + + diff --git a/tests/reject/tsimtych.nim b/tests/reject/tsimtych.nim index b100c62e3..dd969958c 100755 --- a/tests/reject/tsimtych.nim +++ b/tests/reject/tsimtych.nim @@ -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 + + diff --git a/tests/reject/tstatret.nim b/tests/reject/tstatret.nim index ac93ac532..bf90255a0 100755 --- a/tests/reject/tstatret.nim +++ b/tests/reject/tstatret.nim @@ -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 + + diff --git a/tests/reject/tstmtexp.nim b/tests/reject/tstmtexp.nim index f4d83e83f..50248ad32 100755 --- a/tests/reject/tstmtexp.nim +++ b/tests/reject/tstmtexp.nim @@ -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 + + diff --git a/tests/reject/ttempl2.nim b/tests/reject/ttempl2.nim index fba6bd0cb..fba988f95 100755 --- a/tests/reject/ttempl2.nim +++ b/tests/reject/ttempl2.nim @@ -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' + + diff --git a/tests/reject/ttypelessemptyset.nim b/tests/reject/ttypelessemptyset.nim index a49cb8fa0..2335de359 100755 --- a/tests/reject/ttypelessemptyset.nim +++ b/tests/reject/ttypelessemptyset.nim @@ -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: {}) + + diff --git a/tests/reject/tunderscores.nim b/tests/reject/tunderscores.nim index 459cfda30..8075fdae4 100755 --- a/tests/reject/tunderscores.nim +++ b/tests/reject/tunderscores.nim @@ -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_) + + diff --git a/tests/reject/twrongtupleaccess.nim b/tests/reject/twrongtupleaccess.nim index f706e267c..bb09b108d 100755 --- a/tests/reject/twrongtupleaccess.nim +++ b/tests/reject/twrongtupleaccess.nim @@ -1,5 +1,12 @@ +discard """ + file: "twrongtupleaccess.nim" + line: 9 + errormsg: "undeclared field: \'setBLAH\'" +""" # Bugfix var v = (5.0, 10.0) v.setBLAH(10) + + diff --git a/tests/reject/typredef.nim b/tests/reject/typredef.nim index a77d91f40..b2182d116 100755 --- a/tests/reject/typredef.nim +++ b/tests/reject/typredef.nim @@ -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' + + |