diff options
Diffstat (limited to 'tests/accept')
26 files changed, 84 insertions, 49 deletions
diff --git a/tests/accept/compile/tcan_alias_specialised_generic.nim b/tests/accept/compile/tcan_alias_specialised_generic.nim index 9e93e7266..a8f1972c8 100644 --- a/tests/accept/compile/tcan_alias_specialised_generic.nim +++ b/tests/accept/compile/tcan_alias_specialised_generic.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + ## ## can_alias_specialised_generic Nimrod Module ## diff --git a/tests/accept/compile/tconsteval.nim b/tests/accept/compile/tconsteval.nim index ce90d7c27..10af9ad35 100755 --- a/tests/accept/compile/tconsteval.nim +++ b/tests/accept/compile/tconsteval.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + import strutils const diff --git a/tests/accept/compile/tdictdestruct.nim b/tests/accept/compile/tdictdestruct.nim index 8d828aaf7..9c1f27ed8 100755 --- a/tests/accept/compile/tdictdestruct.nim +++ b/tests/accept/compile/tdictdestruct.nim @@ -1,3 +1,6 @@ +discard """ + disabled: true +""" type TDict[TK, TV] = object diff --git a/tests/accept/compile/tgenericmatcher.nim b/tests/accept/compile/tgenericmatcher.nim index eaf3da67c..6ff0dd505 100644 --- a/tests/accept/compile/tgenericmatcher.nim +++ b/tests/accept/compile/tgenericmatcher.nim @@ -1,3 +1,6 @@ +discard """ + disabled: true +""" type TMatcherKind = enum diff --git a/tests/accept/compile/tgenericrefs.nim b/tests/accept/compile/tgenericrefs.nim index b0e77cef5..2a3de7edd 100644 --- a/tests/accept/compile/tgenericrefs.nim +++ b/tests/accept/compile/tgenericrefs.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + # Compiles: type diff --git a/tests/accept/compile/tlexer.nim b/tests/accept/compile/tlexer.nim index 968a10bdf..10a8ab51d 100755 --- a/tests/accept/compile/tlexer.nim +++ b/tests/accept/compile/tlexer.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + # We start with a comment # This is the same comment diff --git a/tests/accept/compile/tmodulealias.nim b/tests/accept/compile/tmodulealias.nim index 1154cb99d..a7d155e51 100755 --- a/tests/accept/compile/tmodulealias.nim +++ b/tests/accept/compile/tmodulealias.nim @@ -1,4 +1,6 @@ - +discard """ + disabled: true +""" when defined(windows): import winlean diff --git a/tests/accept/compile/toop.nim b/tests/accept/compile/toop.nim index d103c6304..db6d9e595 100755 --- a/tests/accept/compile/toop.nim +++ b/tests/accept/compile/toop.nim @@ -1,3 +1,6 @@ +discard """ + disabled: true +""" type TA = object diff --git a/tests/accept/compile/trectuple.nim b/tests/accept/compile/trectuple.nim index c9ac45797..f60fe2841 100755 --- a/tests/accept/compile/trectuple.nim +++ b/tests/accept/compile/trectuple.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + type PNode = ref TNode TNode = tuple[self: PNode] diff --git a/tests/accept/compile/tsortdev.nim b/tests/accept/compile/tsortdev.nim index 1246d7581..c4e63fab4 100755 --- a/tests/accept/compile/tsortdev.nim +++ b/tests/accept/compile/tsortdev.nim @@ -1,3 +1,6 @@ +discard """ + disabled: true +""" import math, algorithm diff --git a/tests/accept/compile/tstrtabs.nim b/tests/accept/compile/tstrtabs.nim index 299db609d..251ec77ef 100755 --- a/tests/accept/compile/tstrtabs.nim +++ b/tests/accept/compile/tstrtabs.nim @@ -1,6 +1,6 @@ import strtabs -var tab = newStringTable(["key1", "val1", "key2", "val2"], +var tab = newStringTable({"key1": "val1", "key2": "val2"}, modeStyleInsensitive) for i in 0..80: tab["key_" & $i] = "value" & $i diff --git a/tests/accept/compile/ttempl3.nim b/tests/accept/compile/ttempl3.nim index 0c8fa9a94..7b2c70f79 100755 --- a/tests/accept/compile/ttempl3.nim +++ b/tests/accept/compile/ttempl3.nim @@ -24,3 +24,19 @@ var ha = 1 echo(ha) + +# Test identifier generation: +template prefix(name: expr): expr = `"hu" name` + +var `hu "XYZ"` = "yay" + +echo prefix(XYZ) + +template typedef(name: expr, typ: typeDesc) = + type + `T name`* = typ + `P name`* = ref `T name` + +typedef(myint, int) +var x: PMyInt + diff --git a/tests/accept/run/tassert.nim b/tests/accept/run/tassert.nim index e32ee0a84..50793c3d6 100755 --- a/tests/accept/run/tassert.nim +++ b/tests/accept/run/tassert.nim @@ -1,22 +1,22 @@ discard """ file: "tassert.nim" - output: "assertion failure!this shall be always written" + outputsub: "assertion failure!this shall be always written" """ -# test assert and exception handling - -proc callB() = assert(False) -proc callA() = callB() -proc callC() = callA() - -try: - callC() -except EAssertionFailed: - write(stdout, "assertion failure!") -except: - write(stdout, "unknown exception!") -finally: - system.write(stdout, "this shall be always written") - -assert(false) #OUT assertion failure!this shall be always written +# test assert and exception handling + +proc callB() = assert(False) +proc callA() = callB() +proc callC() = callA() + +try: + callC() +except EAssertionFailed: + write(stdout, "assertion failure!") +except: + write(stdout, "unknown exception!") +finally: + system.write(stdout, "this shall be always written") + +assert(false) #OUT assertion failure!this shall be always written diff --git a/tests/accept/run/tcgbug.nim b/tests/accept/run/tcgbug.nim index aa0f0fa6b..417b909ae 100755 --- a/tests/accept/run/tcgbug.nim +++ b/tests/accept/run/tcgbug.nim @@ -1,6 +1,6 @@ discard """ file: "tcgbug.nim" - output: "" + output: "success" """ type @@ -19,5 +19,5 @@ var new(a) q(a) - +echo "success" diff --git a/tests/accept/run/tclosure.nim b/tests/accept/run/tclosure.nim index 28a51e1ac..d7c0ec0e3 100755 --- a/tests/accept/run/tclosure.nim +++ b/tests/accept/run/tclosure.nim @@ -1,6 +1,7 @@ discard """ file: "tclosure.nim" output: "2 4 6 8 10" + disabled: true """ # Test the closure implementation diff --git a/tests/accept/run/tcontinuexc.nim b/tests/accept/run/tcontinuexc.nim index c43e68c93..82cce923e 100755 --- a/tests/accept/run/tcontinuexc.nim +++ b/tests/accept/run/tcontinuexc.nim @@ -1,6 +1,6 @@ discard """ file: "tcontinuexc.nim" - output: "ECcaught" + outputsub: "ECcaught" """ type ESomething = object of E_Base diff --git a/tests/accept/run/texcsub.nim b/tests/accept/run/texcsub.nim index 3dba357f9..e78da8df6 100755 --- a/tests/accept/run/texcsub.nim +++ b/tests/accept/run/texcsub.nim @@ -1,6 +1,7 @@ discard """ file: "texcsub.nim" output: "caught!" + disabled: true """ # Test inheritance for exception matching: diff --git a/tests/accept/run/texplicitgeneric2.nim b/tests/accept/run/texplicitgeneric2.nim index f2e628223..95461d023 100755 --- a/tests/accept/run/texplicitgeneric2.nim +++ b/tests/accept/run/texplicitgeneric2.nim @@ -1,5 +1,6 @@ discard """ output: "Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13" + disabled: true """ # test explicit type instantiation diff --git a/tests/accept/run/tfloat1.nim b/tests/accept/run/tfloat1.nim index 3826bf1f5..7d6e0c6a3 100755 --- a/tests/accept/run/tfloat1.nim +++ b/tests/accept/run/tfloat1.nim @@ -1,6 +1,6 @@ discard """ file: "tfloat1.nim" - output: "Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]" + outputsub: "Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]" """ # Test new floating point exceptions diff --git a/tests/accept/run/tfloat2.nim b/tests/accept/run/tfloat2.nim index e7a9ce76f..b0df1e8b7 100755 --- a/tests/accept/run/tfloat2.nim +++ b/tests/accept/run/tfloat2.nim @@ -1,6 +1,6 @@ discard """ file: "tfloat2.nim" - output: "Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]" + outputsub: "Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]" """ # Test new floating point exceptions diff --git a/tests/accept/run/tgenerics1.nim b/tests/accept/run/tgenerics1.nim index cb310f552..5d20a864b 100755 --- a/tests/accept/run/tgenerics1.nim +++ b/tests/accept/run/tgenerics1.nim @@ -41,7 +41,7 @@ proc add*[T](heap: PBinHeap[T], priority: int, data: T) = proc print*[T](heap: PBinHeap[T]) = for i in countup(0, heap.last): - echo heap.heap[i].data + stdout.write($heap.heap[i].data, " ") var heap: PBinHeap[int] diff --git a/tests/accept/run/tmatrix.nim b/tests/accept/run/tmatrix.nim index 1dd09291b..90dfde959 100755 --- a/tests/accept/run/tmatrix.nim +++ b/tests/accept/run/tmatrix.nim @@ -19,30 +19,12 @@ proc createMatrix*(width, height: int): TMatrix = proc width*(m: TMatrix): int {.inline.} = return m.fWidth proc height*(m: TMatrix): int {.inline.} = return m.fHeight -proc `[,]`*(m: TMatrix, x, y: int): float {.inline.} = +proc `[]`*(m: TMatrix, x, y: int): float {.inline.} = result = m.data[x|y] -proc `[,]=`*(m: var TMatrix, x, y: int, val: float) {.inline.} = +proc `[]=`*(m: var TMatrix, x, y: int, val: float) {.inline.} = m.data[x|y] = val -proc `[$ .. $, $ .. $]`*(m: TMatrix, a, b, c, d: int): TMatrix = - result = createMatrix(b-a+1, d-c+1) - for x in a..b: - for y in c..d: - result[x-a, y-c] = m[x, y] - -proc `[$ .. $, $ .. $]=`*(m: var TMatrix, a, b, c, d: int, val: float) = - for x in a..b: - for y in c..d: - m[x, y] = val - -proc `[$ .. $, $ .. $]=`*(m: var TMatrix, a, b, c, d: int, val: TMatrix) = - assert val.width == b-a+1 - assert val.height == d-c+1 - for x in a..b: - for y in c..d: - m[x, y] = val[x-a, y-c] - proc `-|`*(m: TMatrix): TMatrix = ## transposes a matrix result = createMatrix(m.height, m.width) diff --git a/tests/accept/run/toverflw2.nim b/tests/accept/run/toverflw2.nim index 14a77ebad..075eae9e9 100755 --- a/tests/accept/run/toverflw2.nim +++ b/tests/accept/run/toverflw2.nim @@ -1,6 +1,6 @@ discard """ file: "toverflw2.nim" - output: "Error: unhandled exception: over- or underflow [EOverflow]" + outputsub: "Error: unhandled exception: over- or underflow [EOverflow]" """ var a : int32 = 2147483647 var b : int32 = 2147483647 diff --git a/tests/accept/run/treraise.nim b/tests/accept/run/treraise.nim index 7e147c336..71736b512 100755 --- a/tests/accept/run/treraise.nim +++ b/tests/accept/run/treraise.nim @@ -1,6 +1,6 @@ discard """ file: "treraise.nim" - output: "Error: unhandled exception: bla [ESomeOtherErr]" + outputsub: "Error: unhandled exception: bla [ESomeOtherErr]" """ type ESomething = object of E_Base diff --git a/tests/accept/run/tunhandledexc.nim b/tests/accept/run/tunhandledexc.nim index c60de2234..ae62b4ee5 100755 --- a/tests/accept/run/tunhandledexc.nim +++ b/tests/accept/run/tunhandledexc.nim @@ -1,6 +1,6 @@ discard """ file: "tunhandledexc.nim" - output: "Error: unhandled exception: bla [ESomeOtherErr]" + outputsub: "Error: unhandled exception: bla [ESomeOtherErr]" """ type ESomething = object of E_Base diff --git a/tests/accept/run/twrongexc.nim b/tests/accept/run/twrongexc.nim index 592693769..81f4d5595 100755 --- a/tests/accept/run/twrongexc.nim +++ b/tests/accept/run/twrongexc.nim @@ -1,6 +1,6 @@ discard """ file: "twrongexc.nim" - output: "Error: unhandled exception [EInvalidValue]" + outputsub: "Error: unhandled exception [EInvalidValue]" """ try: raise newException(EInvalidValue, "") |