diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actiontable/tactiontable2.nim | 3 | ||||
-rw-r--r-- | tests/assert/tfailedassert.nim | 4 | ||||
-rw-r--r-- | tests/ccgbugs/tmissingderef.nim | 30 | ||||
-rw-r--r-- | tests/cpp/trawsockets.nim | 2 | ||||
-rw-r--r-- | tests/cpp/ttypeinfo.nim | 2 | ||||
-rw-r--r-- | tests/deprecated/tdeprecated.nim | 4 | ||||
-rw-r--r-- | tests/destructor/tdestructor2.nim | 10 | ||||
-rw-r--r-- | tests/exception/tdefer1.nim | 18 | ||||
-rw-r--r-- | tests/global/tglobal.nim | 2 | ||||
-rw-r--r-- | tests/objects/tobjpragma.nim | 3 | ||||
-rw-r--r-- | tests/overload/tprefer_tygenericinst.nim | 17 | ||||
-rw-r--r-- | tests/stdlib/tmarshal.nim | 12 | ||||
-rw-r--r-- | tests/testament/categories.nim | 44 | ||||
-rw-r--r-- | tests/trmacros/tor.nim | 2 |
14 files changed, 111 insertions, 42 deletions
diff --git a/tests/actiontable/tactiontable2.nim b/tests/actiontable/tactiontable2.nim index 99bb3dca0..fbc65a67d 100644 --- a/tests/actiontable/tactiontable2.nim +++ b/tests/actiontable/tactiontable2.nim @@ -1,6 +1,5 @@ discard """ - line: 21 - errormsg: "invalid type: 'Table[string, proc (string){.gcsafe.}]'" + output: "action 3 arg" """ import tables diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim index 8766321bf..16769f529 100644 --- a/tests/assert/tfailedassert.nim +++ b/tests/assert/tfailedassert.nim @@ -3,14 +3,14 @@ discard """ WARNING: false first assertion from bar ERROR: false second assertion from bar -1 -tests/assert/tfailedassert.nim:27 false assertion from foo +tfailedassert.nim:27 false assertion from foo ''' """ type TLineInfo = tuple[filename: string, line: int] - TMyError = object of E_Base + TMyError = object of Exception lineinfo: TLineInfo EMyError = ref TMyError diff --git a/tests/ccgbugs/tmissingderef.nim b/tests/ccgbugs/tmissingderef.nim new file mode 100644 index 000000000..edff1dd4e --- /dev/null +++ b/tests/ccgbugs/tmissingderef.nim @@ -0,0 +1,30 @@ +discard """ + output: '''255 +1 1 +0.5''' +""" + +# bug #1181 + +type + TFoo = object + x: int32 + +proc mainowar = + var foo: TFoo + foo.x = 0xff + var arr1 = cast[ptr array[4, uint8]](addr foo)[] # Fails. + echo arr1[when cpuEndian == littleEndian: 0 else: 3] + + var i = 1i32 + let x = addr i + var arr2 = cast[ptr array[4, uint8]](x)[] # Fails. + echo arr2[when cpuEndian == littleEndian: 0 else: 3], " ", i + + # bug #1715 + var a: array[2, float32] = [0.5'f32, 0.7] + let p = addr a + var b = p[] + echo b[0] + +mainowar() diff --git a/tests/cpp/trawsockets.nim b/tests/cpp/trawsockets.nim index d034245d0..bc129de57 100644 --- a/tests/cpp/trawsockets.nim +++ b/tests/cpp/trawsockets.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nim cpp $target" + cmd: "nim cpp $file" """ import rawsockets diff --git a/tests/cpp/ttypeinfo.nim b/tests/cpp/ttypeinfo.nim index e72883dbf..1529c86e9 100644 --- a/tests/cpp/ttypeinfo.nim +++ b/tests/cpp/ttypeinfo.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nim cpp $target" + cmd: "nim cpp $file" """ import typeinfo diff --git a/tests/deprecated/tdeprecated.nim b/tests/deprecated/tdeprecated.nim index f41f0a72f..ed3d2733a 100644 --- a/tests/deprecated/tdeprecated.nim +++ b/tests/deprecated/tdeprecated.nim @@ -1,6 +1,5 @@ discard """ - line: 9 - errormsg: "'a' is deprecated [Deprecated]" + nimout: "'a' is deprecated [Deprecated]" """ var @@ -8,4 +7,3 @@ var a[8] = 1 - diff --git a/tests/destructor/tdestructor2.nim b/tests/destructor/tdestructor2.nim index 1bdf4993b..6f966d861 100644 --- a/tests/destructor/tdestructor2.nim +++ b/tests/destructor/tdestructor2.nim @@ -1,6 +1,6 @@ discard """ - line: 20 - errormsg: " usage of a type with a destructor in a non destructible context" + line: 23 + nimout: " usage of a type with a destructor in a non destructible context" """ {.experimental.} @@ -19,5 +19,9 @@ proc open: TMyObj = proc `$`(x: TMyObj): string = $x.y -echo open() +proc foo = + discard open() + +# XXX doesn't trigger this yet: +#echo open() diff --git a/tests/exception/tdefer1.nim b/tests/exception/tdefer1.nim new file mode 100644 index 000000000..61439530a --- /dev/null +++ b/tests/exception/tdefer1.nim @@ -0,0 +1,18 @@ +discard """ + output: '''hi +hi''' +""" + +# bug #1742 + +template test(): expr = + let a = 0 + defer: echo "hi" + a + +let i = test() + +import strutils +let x = try: parseInt("133a") + except: -1 + finally: echo "hi" diff --git a/tests/global/tglobal.nim b/tests/global/tglobal.nim index 84c4510c1..d44a62afc 100644 --- a/tests/global/tglobal.nim +++ b/tests/global/tglobal.nim @@ -1,6 +1,6 @@ discard """ - file: "toop1.nim" output: "in globalaux2: 10\ntotal globals: 2\nint value: 100\nstring value: second" + disabled: "true" """ import globalaux, globalaux2 diff --git a/tests/objects/tobjpragma.nim b/tests/objects/tobjpragma.nim index f9fbd5e40..dda8057b6 100644 --- a/tests/objects/tobjpragma.nim +++ b/tests/objects/tobjpragma.nim @@ -7,8 +7,11 @@ discard """ 1 2 3''' + disabled: "true" """ +# Disabled since some versions of GCC ignore the 'packed' attribute + # Test type diff --git a/tests/overload/tprefer_tygenericinst.nim b/tests/overload/tprefer_tygenericinst.nim new file mode 100644 index 000000000..2700bed5e --- /dev/null +++ b/tests/overload/tprefer_tygenericinst.nim @@ -0,0 +1,17 @@ +discard """ + output: "Version 2 was called." + disabled: true +""" + +# bug #2220 + +type A[T] = object +type B = A[int] + +proc p[X](x: X) = + echo "Version 1 was called." + +proc p(x: B) = + echo "Version 2 was called." + +p(B()) # This call reported as ambiguous. diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim index 1b83aab53..a778d2f77 100644 --- a/tests/stdlib/tmarshal.nim +++ b/tests/stdlib/tmarshal.nim @@ -6,11 +6,11 @@ import marshal template testit(x: expr) = discard $$to[type(x)]($$x) -var x: array[0..4, array[0..4, string]] = [ - ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], - ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], - ["test", "1", "2", "3", "4"]] -testit(x) +var x: array[0..4, array[0..4, string]] = [ + ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], + ["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"], + ["test", "1", "2", "3", "4"]] +testit(x) var test2: tuple[name: string, s: int] = ("tuple test", 56) testit(test2) @@ -24,7 +24,7 @@ type of blah: help: string else: - nil + discard PNode = ref TNode TNode = object diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index ed4d27cab..ab1e46d6f 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -230,17 +230,17 @@ proc testStdlib(r: var TResults, pattern, options: string, cat: Category) = else: testNoSpec r, makeTest(test, options, cat, actionCompile) -# ----------------------------- babel ---------------------------------------- +# ----------------------------- nimble ---------------------------------------- type PackageFilter = enum pfCoreOnly pfExtraOnly pfAll let - babelExe = findExe("babel") - babelDir = getHomeDir() / ".babel" - packageDir = babelDir / "pkgs" - packageIndex = babelDir / "packages.json" + nimbleExe = findExe("nimble") + nimbleDir = getHomeDir() / ".nimble" + packageDir = nimbleDir / "pkgs" + packageIndex = nimbleDir / "packages.json" proc waitForExitEx(p: Process): int = var outp = outputStream(p) @@ -255,7 +255,7 @@ proc waitForExitEx(p: Process): int = proc getPackageDir(package: string): string = ## TODO - Replace this with dom's version comparison magic. - var commandOutput = execCmdEx("babel path $#" % package) + var commandOutput = execCmdEx("nimble path $#" % package) if commandOutput.exitCode != QuitSuccess: return "" else: @@ -268,7 +268,7 @@ iterator listPackages(filter: PackageFilter): tuple[name, url: string] = let name = package["name"].str url = package["url"].str - isCorePackage = "nimrod-code" in normalize(url) + isCorePackage = "nim-lang" in normalize(url) case filter: of pfCoreOnly: if isCorePackage: @@ -279,13 +279,13 @@ iterator listPackages(filter: PackageFilter): tuple[name, url: string] = of pfAll: yield (name, url) -proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) = - if babelExe == "": - echo("[Warning] - Cannot run babel tests: Babel binary not found.") +proc testNimblePackages(r: var TResults, cat: Category, filter: PackageFilter) = + if nimbleExe == "": + echo("[Warning] - Cannot run nimble tests: Nimble binary not found.") return - if execCmd("$# update" % babelExe) == QuitFailure: - echo("[Warning] - Cannot run babel tests: Babel update failed.") + if execCmd("$# update" % nimbleExe) == QuitFailure: + echo("[Warning] - Cannot run nimble tests: Nimble update failed.") return let packageFileTest = makeTest("PackageFileParsed", "", cat) @@ -294,7 +294,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) = var test = makeTest(name, "", cat) echo(url) let - installProcess = startProcess(babelExe, "", ["install", "-y", name]) + installProcess = startProcess(nimbleExe, "", ["install", "-y", name]) installStatus = waitForExitEx(installProcess) installProcess.close if installStatus != QuitSuccess: @@ -304,7 +304,7 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) = let buildPath = getPackageDir(name)[0.. -3] let - buildProcess = startProcess(babelExe, buildPath, ["build"]) + buildProcess = startProcess(nimbleExe, buildPath, ["build"]) buildStatus = waitForExitEx(buildProcess) buildProcess.close if buildStatus != QuitSuccess: @@ -312,13 +312,13 @@ proc testBabelPackages(r: var TResults, cat: Category, filter: PackageFilter) = r.addResult(test, "", "", reSuccess) r.addResult(packageFileTest, "", "", reSuccess) except JsonParsingError: - echo("[Warning] - Cannot run babel tests: Invalid package file.") + echo("[Warning] - Cannot run nimble tests: Invalid package file.") r.addResult(packageFileTest, "", "", reBuildFailed) # ---------------------------------------------------------------------------- -const AdditionalCategories = ["debugger", "examples", "lib", "babel-core"] +const AdditionalCategories = ["debugger", "examples", "lib", "nimble-core"] proc `&.?`(a, b: string): string = # candidate for the stdlib? @@ -356,12 +356,12 @@ proc processCategory(r: var TResults, cat: Category, options: string) = compileExample(r, "examples/*.nim", options, cat) compileExample(r, "examples/gtk/*.nim", options, cat) compileExample(r, "examples/talk/*.nim", options, cat) - of "babel-core": - testBabelPackages(r, cat, pfCoreOnly) - of "babel-extra": - testBabelPackages(r, cat, pfExtraOnly) - of "babel-all": - testBabelPackages(r, cat, pfAll) + of "nimble-core": + testNimblePackages(r, cat, pfCoreOnly) + of "nimble-extra": + testNimblePackages(r, cat, pfExtraOnly) + of "nimble-all": + testNimblePackages(r, cat, pfAll) else: for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): testSpec r, makeTest(name, options, cat) diff --git a/tests/trmacros/tor.nim b/tests/trmacros/tor.nim index dc72a96cd..500851582 100644 --- a/tests/trmacros/tor.nim +++ b/tests/trmacros/tor.nim @@ -1,5 +1,5 @@ discard """ - output: '''3060 + output: '''3030 true 3''' """ |