diff options
Diffstat (limited to 'tests')
29 files changed, 56 insertions, 52 deletions
diff --git a/tests/assert/tassert.nim b/tests/assert/tassert.nim index b3df30bd1..b5f2fb715 100644 --- a/tests/assert/tassert.nim +++ b/tests/assert/tassert.nim @@ -11,7 +11,7 @@ proc callC() = callA() try: callC() -except EAssertionFailed: +except AssertionError: write(stdout, "assertion failure!") except: write(stdout, "unknown exception!") diff --git a/tests/assign/tobjasgn.nim b/tests/assign/tobjasgn.nim index e731d9e93..adfcfb087 100644 --- a/tests/assign/tobjasgn.nim +++ b/tests/assign/tobjasgn.nim @@ -8,7 +8,7 @@ assignment test a:test b:1 c:2 haha:3 # bug #1005 type - TSomeObj = object of TObject + TSomeObj = object of RootObj a, b: int PSomeObj = ref object a, b: int @@ -20,7 +20,7 @@ echo a.a, " ", b.a, " ", a.b, " ", b.b # bug #575 type - Something = object of Tobject + Something = object of RootObj a: string b, c: int32 diff --git a/tests/async/tasyncexceptions.nim b/tests/async/tasyncexceptions.nim index efe31ef27..7aa1d7fb0 100644 --- a/tests/async/tasyncexceptions.nim +++ b/tests/async/tasyncexceptions.nim @@ -20,7 +20,7 @@ proc processClient(fd: int) {.async.} = var line = await recvLine(fd) var foo = line[0] if foo == 'g': - raise newException(EBase, "foobar") + raise newException(Exception, "foobar") proc serve() {.async.} = diff --git a/tests/async/tasynctry.nim b/tests/async/tasynctry.nim index 6749aabbf..0fe9efdc1 100644 --- a/tests/async/tasynctry.nim +++ b/tests/async/tasynctry.nim @@ -15,7 +15,7 @@ import asyncdispatch, strutils proc foobar() {.async.} = if 5 == 5: - raise newException(EInvalidIndex, "Test") + raise newException(IndexError, "Test") proc catch() {.async.} = # TODO: Create a test for when exceptions are not caught. @@ -26,26 +26,26 @@ proc catch() {.async.} = try: await foobar() - except EInvalidIndex: + except IndexError: echo("Specific except") try: await foobar() - except OSError, EInvalidField, EInvalidIndex: + except OSError, FieldError, IndexError: echo("Multiple idents in except") try: await foobar() - except OSError, EInvalidField: + except OSError, FieldError: assert false - except EInvalidIndex: + except IndexError: echo("Multiple except branches") try: await foobar() - except EInvalidIndex: + except IndexError: echo("Multiple except branches 2") - except OSError, EInvalidField: + except OSError, FieldError: assert false waitFor catch() diff --git a/tests/async/twinasyncrw.nim b/tests/async/twinasyncrw.nim index 17b7d1cf5..42a7e3058 100644 --- a/tests/async/twinasyncrw.nim +++ b/tests/async/twinasyncrw.nim @@ -14,7 +14,7 @@ when defined(windows): var clientCount = 0 proc winConnect*(socket: AsyncFD, address: string, port: Port, - domain = Domain.AF_INET): Future[void] = + domain = Domain.AF_INET): Future[void] = var retFuture = newFuture[void]("winConnect") proc cb(fd: AsyncFD): bool = var ret = SocketHandle(fd).getSockOptInt(cint(SOL_SOCKET), cint(SO_ERROR)) @@ -183,7 +183,7 @@ when defined(windows): ## **Note**: This procedure is mostly used for testing. You likely want to ## use ``asyncnet.recvLine`` instead. - template addNLIfEmpty(): stmt = + template addNLIfEmpty() = if result.len == 0: result.add("\c\L") diff --git a/tests/discard/tdiscardable.nim b/tests/discard/tdiscardable.nim index 662d2725a..f979b29c9 100644 --- a/tests/discard/tdiscardable.nim +++ b/tests/discard/tdiscardable.nim @@ -13,7 +13,7 @@ q[float](0.8, 0.2) # bug #942 -template maybeMod(x: Tinteger, module:Natural): untyped = +template maybeMod(x: SomeInteger, module: Natural): untyped = if module > 0: x mod module else: x diff --git a/tests/effects/teffects3.nim b/tests/effects/teffects3.nim index 1b18f7b6d..bd4e0f7c9 100644 --- a/tests/effects/teffects3.nim +++ b/tests/effects/teffects3.nim @@ -11,7 +11,7 @@ type EIO2 = ref object of EIO -proc raiser(): int {.tags: [TObj, FWriteIO].} = +proc raiser(): int {.tags: [TObj, WriteIoEffect].} = writeLine stdout, "arg" var o: TObjB diff --git a/tests/effects/teffects4.nim b/tests/effects/teffects4.nim index d0960126f..dcfab1299 100644 --- a/tests/effects/teffects4.nim +++ b/tests/effects/teffects4.nim @@ -7,11 +7,11 @@ type TObj = object {.pure, inheritable.} TObjB = object of TObj a, b, c: string - fn: proc (): int {.tags: [FReadIO].} + fn: proc (): int {.tags: [ReadIOEffect].} EIO2 = ref object of EIO -proc q() {.tags: [FIO].} = +proc q() {.tags: [IoEffect].} = discard proc raiser(): int = diff --git a/tests/effects/teffects6.nim b/tests/effects/teffects6.nim index e69fe73b6..ded43b7b4 100644 --- a/tests/effects/teffects6.nim +++ b/tests/effects/teffects6.nim @@ -11,7 +11,7 @@ createMenuItem(s, "Go to definition...", proc (i: PMenuItem, p: pointer) {.cdecl.} = try: echo(i.repr) - except EInvalidValue: + except ValueError: echo("blah") ) diff --git a/tests/errmsgs/t1154.nim b/tests/errmsgs/t1154.nim index 7fcbf8a27..fee9d0ad6 100644 --- a/tests/errmsgs/t1154.nim +++ b/tests/errmsgs/t1154.nim @@ -1,11 +1,11 @@ discard """ -errormsg: "invalid type: 'expr' in this context: 'proc (a: varargs[expr])' for proc" +errormsg: "invalid type: 'untyped' in this context: 'proc (a: varargs[untyped])' for proc" line: 8 """ import typetraits -proc foo(a:varargs[expr]) = +proc foo(a:varargs[untyped]) = echo a[0].type.name foo(1) diff --git a/tests/exception/tcontinuexc.nim b/tests/exception/tcontinuexc.nim index fb9b523d7..2a05da9c0 100644 --- a/tests/exception/tcontinuexc.nim +++ b/tests/exception/tcontinuexc.nim @@ -4,8 +4,8 @@ discard """ exitcode: "1" """ type - ESomething = object of E_Base - ESomeOtherErr = object of E_Base + ESomething = object of Exception + ESomeOtherErr = object of Exception proc genErrors(s: string) = if s == "error!": diff --git a/tests/fields/tfieldindex.nim b/tests/fields/tfieldindex.nim index d11c1a8b2..6de6d54bd 100644 --- a/tests/fields/tfieldindex.nim +++ b/tests/fields/tfieldindex.nim @@ -14,7 +14,7 @@ proc indexOf*(t: typedesc, name: string): int = for n, x in fieldPairs(d): if n == name: return i i.inc - raise newException(EInvalidValue, "No field " & name & " in type " & + raise newException(ValueError, "No field " & name & " in type " & astToStr(t)) echo TMyTuple.indexOf("b") diff --git a/tests/gc/gcleak2.nim b/tests/gc/gcleak2.nim index facb8a008..fe1718aef 100644 --- a/tests/gc/gcleak2.nim +++ b/tests/gc/gcleak2.nim @@ -6,11 +6,11 @@ when defined(GC_setMaxPause): GC_setMaxPause 2_000 type - TTestObj = object of TObject + TTestObj = object of RootObj x: string s: seq[int] -proc MakeObj(): TTestObj = +proc makeObj(): TTestObj = result.x = "Hello" result.s = @[1,2,3] @@ -19,7 +19,7 @@ proc inProc() = when defined(gcMarkAndSweep) or defined(boehmgc): GC_fullcollect() var obj: TTestObj - obj = MakeObj() + obj = makeObj() if getOccupiedMem() > 300_000: quit("still a leak!") inProc() diff --git a/tests/generics/t5643.nim b/tests/generics/t5643.nim index 962d5cef5..f303bbc70 100644 --- a/tests/generics/t5643.nim +++ b/tests/generics/t5643.nim @@ -1,5 +1,5 @@ type - Matrix*[M, N: static[int], T: SomeReal] = object + Matrix*[M, N: static[int], T: SomeFloat] = object data: ref array[N * M, T] Matrix64*[M, N: static[int]] = Matrix[M, N, float64] diff --git a/tests/generics/tcan_inherit_generic.nim b/tests/generics/tcan_inherit_generic.nim index 331fcfd5c..69e06c4a5 100644 --- a/tests/generics/tcan_inherit_generic.nim +++ b/tests/generics/tcan_inherit_generic.nim @@ -4,7 +4,7 @@ ## Created by Eric Doughty-Papassideris on 2011-02-16. type - TGen[T] = object of TObject + TGen[T] = object of RootObj x, y: T TSpef[T] = object of TGen[T] diff --git a/tests/generics/tgenericprop.nim b/tests/generics/tgenericprop.nim index 7cddf5617..21ffdf289 100644 --- a/tests/generics/tgenericprop.nim +++ b/tests/generics/tgenericprop.nim @@ -1,11 +1,11 @@ type - TProperty[T] = object of TObject + TProperty[T] = object of RootObj getProc: proc(property: TProperty[T]): T {.nimcall.} setProc: proc(property: TProperty[T], value: T) {.nimcall.} value: T -proc newProperty[T](value: TObject): TProperty[T] = +proc newProperty[T](value: RootObj): TProperty[T] = result.getProc = proc (property: TProperty[T]) = return property.value diff --git a/tests/generics/tparam_binding.nim b/tests/generics/tparam_binding.nim index 55acb8f06..cd0d58e02 100644 --- a/tests/generics/tparam_binding.nim +++ b/tests/generics/tparam_binding.nim @@ -4,7 +4,7 @@ discard """ """ type - Matrix[M,N: static[int]; T: SomeReal] = distinct array[0..(M*N - 1), T] + Matrix[M,N: static[int]; T: SomeFloat] = distinct array[0..(M*N - 1), T] let a = new Matrix[2,2,float] let b = new Matrix[2,1,float] diff --git a/tests/init/tuninit1.nim b/tests/init/tuninit1.nim index 886a1d766..891f1e96c 100644 --- a/tests/init/tuninit1.nim +++ b/tests/init/tuninit1.nim @@ -22,7 +22,7 @@ proc p = try: z = parseInt("1233") - except E_Base: + except Exception: case x of 34: z = 123 of 13: z = 34 diff --git a/tests/lexer/tident.nim b/tests/lexer/tident.nim index 68cc01e70..3327344a5 100644 --- a/tests/lexer/tident.nim +++ b/tests/lexer/tident.nim @@ -1,6 +1,6 @@ type - TIdObj* = object of TObject + TIdObj* = object of RootObj id*: int # unique id; use this for comparisons and not the pointers PIdObj* = ref TIdObj diff --git a/tests/manyloc/keineschweine/lib/map_filter.nim b/tests/manyloc/keineschweine/lib/map_filter.nim index 42ef74ceb..f3f1df190 100644 --- a/tests/manyloc/keineschweine/lib/map_filter.nim +++ b/tests/manyloc/keineschweine/lib/map_filter.nim @@ -1,4 +1,4 @@ -template filterIt2*(seq, pred: expr, body: stmt): stmt {.immediate, dirty.} = +template filterIt2*(seq, pred: untyped, body: untyped) = ## sequtils defines a filterIt() that returns a new seq, but this one is called ## with a statement body to iterate directly over it for it in items(seq): @@ -13,8 +13,8 @@ proc mapInPlace*[A](x: var seq[A], fun: proc(y: A): A {.closure.}) = for i in 0..x.len-1: x[i] = fun(x[i]) -template unless*(condition: expr; body: stmt): stmt {.dirty.} = - if not(condition): +template unless*(condition: untyped; body: untyped) {.dirty.} = + if not condition: body when isMainModule: diff --git a/tests/manyloc/keineschweine/lib/sg_gui.nim b/tests/manyloc/keineschweine/lib/sg_gui.nim index b7448d9df..95cef1b24 100644 --- a/tests/manyloc/keineschweine/lib/sg_gui.nim +++ b/tests/manyloc/keineschweine/lib/sg_gui.nim @@ -5,13 +5,13 @@ from strutils import countlines type PGuiContainer* = ref TGuiContainer - TGuiContainer* = object of TObject + TGuiContainer* = object of RootObj position: TVector2f activeEntry: PTextEntry widgets: seq[PGuiObject] buttons: seq[PButton] PGuiObject* = ref TGuiObject - TGuiObject* = object of TObject + TGuiObject* = object of RootObj PButton* = ref TButton TButton* = object of TGuiObject enabled: bool diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim index 728619e47..fc871cb80 100644 --- a/tests/manyloc/nake/nake.nim +++ b/tests/manyloc/nake/nake.nim @@ -22,10 +22,10 @@ proc runTask*(name: string) {.inline.} proc shell*(cmd: varargs[string, `$`]): int {.discardable.} proc cd*(dir: string) {.inline.} -template nakeImports*(): stmt {.immediate.} = +template nakeImports*() = import tables, parseopt, strutils, os -template task*(name: string; description: string; body: stmt): stmt {.dirty, immediate.} = +template task*(name: string; description: string; body: untyped) {.dirty.} = block: var t = newTask(description, proc() {.closure.} = body) @@ -40,7 +40,7 @@ proc runTask*(name: string) = tasks[name].action() proc shell*(cmd: varargs[string, `$`]): int = result = execShellCmd(cmd.join(" ")) proc cd*(dir: string) = setCurrentDir(dir) -template withDir*(dir: string; body: stmt): stmt = +template withDir*(dir: string; body: untyped) = ## temporary cd ## withDir "foo": ## # inside foo diff --git a/tests/manyloc/standalone/panicoverride.nim b/tests/manyloc/standalone/panicoverride.nim index d9b3f4388..9d0d070c7 100644 --- a/tests/manyloc/standalone/panicoverride.nim +++ b/tests/manyloc/standalone/panicoverride.nim @@ -2,6 +2,10 @@ proc printf(frmt: cstring) {.varargs, importc, header: "<stdio.h>", cdecl.} proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.} +proc nimToCStringConv(s: NimString): cstring {.compilerProc, inline.} = + if s == nil or s.len == 0: result = cstring"" + else: result = cstring(addr s.data) + {.push stack_trace: off, profiler:off.} proc rawoutput(s: string) = diff --git a/tests/method/tmultim4.nim b/tests/method/tmultim4.nim index eabf8d126..a1d65d570 100644 --- a/tests/method/tmultim4.nim +++ b/tests/method/tmultim4.nim @@ -3,15 +3,15 @@ discard """ output: "hello" """ type - Test = object of TObject + Test = object of RootObj -method doMethod(a: ref TObject) {.base, raises: [EIO].} = +method doMethod(a: ref RootObj) {.base, raises: [IoError].} = quit "override" method doMethod(a: ref Test) = echo "hello" if a == nil: - raise newException(EIO, "arg") + raise newException(IoError, "arg") proc doProc(a: ref Test) = echo "hello" diff --git a/tests/objects/tinherentedvalues.nim b/tests/objects/tinherentedvalues.nim index ad7b5f326..7d4d7d23e 100644 --- a/tests/objects/tinherentedvalues.nim +++ b/tests/objects/tinherentedvalues.nim @@ -6,7 +6,7 @@ true # bug #1053 type - TA = object of TObject + TA = object of RootObj a: int TB = object of TA @@ -32,13 +32,13 @@ test(v) # bug #924 type - MyObject = object of TObject + MyObject = object of RootObj x: int var asd: MyObject -proc isMyObject(obj: TObject) = +proc isMyObject(obj: RootObj) = echo obj of MyObject if obj of MyObject: let a = MyObject(obj) @@ -46,7 +46,7 @@ proc isMyObject(obj: TObject) = asd.x = 5 -#var asdCopy = TObject(asd) +#var asdCopy = RootObj(asd) #echo asdCopy of MyObject isMyObject(asd) diff --git a/tests/objects/tobjcov.nim b/tests/objects/tobjcov.nim index cf2e5becf..c766adde0 100644 --- a/tests/objects/tobjcov.nim +++ b/tests/objects/tobjcov.nim @@ -1,7 +1,7 @@ # Covariance is not type safe: type - TA = object of TObject + TA = object of RootObj a: int TB = object of TA b: array[0..5000_000, int] diff --git a/tests/overload/toverl4.nim b/tests/overload/toverl4.nim index b63265bdf..a15716852 100644 --- a/tests/overload/toverl4.nim +++ b/tests/overload/toverl4.nim @@ -43,7 +43,7 @@ proc find*[TKey, TData](root: PElement[TKey, TData], key: TKey): TData {.raises: if tmp_element.key == key: return tmp_element.left.data else: - raise newException(EInvalidKey, "key does not exist: " & key) + raise newException(KeyError, "key does not exist: " & key) proc add*[TKey, TData](root: var PElement[TKey, TData], key: TKey, data: TData) : bool = if root.left == nil: diff --git a/tests/overload/toverwr.nim b/tests/overload/toverwr.nim index 5945a6149..b5791072e 100644 --- a/tests/overload/toverwr.nim +++ b/tests/overload/toverwr.nim @@ -4,7 +4,7 @@ discard """ """ # Test the overloading resolution in connection with a qualifier -proc write(t: TFile, s: string) = +proc write(t: File, s: string) = discard # a nop system.write(stdout, "hello") diff --git a/tests/template/ttempl3.nim b/tests/template/ttempl3.nim index 91d416c48..a8e136801 100644 --- a/tests/template/ttempl3.nim +++ b/tests/template/ttempl3.nim @@ -1,5 +1,5 @@ -template withOpenFile(f: untyped, filename: string, mode: TFileMode, +template withOpenFile(f: untyped, filename: string, mode: FileMode, actions: untyped): untyped = block: # test that 'f' is implicitly 'injecting': |