diff options
author | metagn <metagngn@gmail.com> | 2023-06-06 07:54:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 06:54:07 +0200 |
commit | b97d603cd00a210547bda1a2a1c3e09f97fcc49e (patch) | |
tree | 080b4ad7b5826b88a9483c6a0e4d697096f12cc1 | |
parent | 2ab948ce53e3d9b80bf9b02644c8ec8991f34d0a (diff) | |
download | Nim-b97d603cd00a210547bda1a2a1c3e09f97fcc49e.tar.gz |
some test cleanups & category reorganization (#22010)
* clean up some test categories * mention exact slice issue * magics into system * move trangechecks into overflow * move tmemory to system * try fix CI * try fix CI * final CI fix
-rw-r--r-- | testament/categories.nim | 4 | ||||
-rw-r--r-- | testament/testament.nim | 2 | ||||
-rw-r--r-- | tests/array/tinvalidarrayaccess.nim (renamed from tests/misc/tinvalidarrayaccess.nim) | 0 | ||||
-rw-r--r-- | tests/array/tinvalidarrayaccess2.nim (renamed from tests/misc/tinvalidarrayaccess2.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tdatabind.nim | 95 | ||||
-rw-r--r-- | tests/c/tcompile.c (renamed from tests/compilepragma/test.c) | 0 | ||||
-rw-r--r-- | tests/c/tcompile.nim (renamed from tests/compilepragma/test.nim) | 2 | ||||
-rw-r--r-- | tests/c/temit.nim (renamed from tests/misc/temit.nim) | 0 | ||||
-rw-r--r-- | tests/c/treservedcidentsasfields.nim (renamed from tests/misc/treservedcidentsasfields.nim) | 78 | ||||
-rw-r--r-- | tests/collections/tactiontable.nim (renamed from tests/actiontable/tactiontable.nim) | 0 | ||||
-rw-r--r-- | tests/config.nims | 2 | ||||
-rw-r--r-- | tests/constructors/a.nim (renamed from tests/constr/a.nim) | 0 | ||||
-rw-r--r-- | tests/constructors/b.nim (renamed from tests/constr/b.nim) | 0 | ||||
-rw-r--r-- | tests/constructors/t18990.nim (renamed from tests/constr/t18990.nim) | 0 | ||||
-rw-r--r-- | tests/constructors/tconstr1.nim (renamed from tests/constr/tconstr1.nim) | 0 | ||||
-rw-r--r-- | tests/constructors/tconstr2.nim (renamed from tests/constr/tconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/deprecated/tannot.nim | 9 | ||||
-rw-r--r-- | tests/deprecated/tconst.nim | 8 | ||||
-rw-r--r-- | tests/deprecated/tmessages.nim | 10 | ||||
-rw-r--r-- | tests/deprecated/tmodule1.nim | 33 | ||||
-rw-r--r-- | tests/distinct/tborrow.nim (renamed from tests/borrow/tborrow.nim) | 0 | ||||
-rw-r--r-- | tests/distinct/tinvalidborrow.nim (renamed from tests/borrow/tinvalidborrow.nim) | 0 | ||||
-rw-r--r-- | tests/distinct/typeclassborrow.nim (renamed from tests/borrow/typeclassborrow.nim) | 0 | ||||
-rw-r--r-- | tests/effects/toutparam.nim | 28 | ||||
-rw-r--r-- | tests/errmsgs/mb.nim (renamed from tests/clearmsg/mb.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/mc.nim (renamed from tests/clearmsg/mc.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/ta.nim (renamed from tests/clearmsg/ta.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/tconsttypemismatch.nim (renamed from tests/clearmsg/tconsttypemismatch.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/tmacroerrorproc.nim (renamed from tests/clearmsg/tmacroerrorproc.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/tnoop.nim (renamed from tests/misc/tnoop.nim) | 0 | ||||
-rw-r--r-- | tests/errmsgs/tsimpletypecheck.nim (renamed from tests/misc/tsimtych.nim) | 2 | ||||
-rw-r--r-- | tests/generics/mfriends.nim (renamed from tests/friends/mfriends.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tconstraints.nim (renamed from tests/constraints/tconstraints.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tfriends.nim (renamed from tests/friends/tfriends.nim) | 0 | ||||
-rw-r--r-- | tests/generics/toverloading_typedesc.nim | 5 | ||||
-rw-r--r-- | tests/global/a_module.nim (renamed from tests/constr/a_module.nim) | 0 | ||||
-rw-r--r-- | tests/global/tglobal2.nim (renamed from tests/constr/tglobal.nim) | 0 | ||||
-rw-r--r-- | tests/init/tinitchecks_v2.nim | 24 | ||||
-rw-r--r-- | tests/init/tproveinit.nim (renamed from tests/misc/tproveinit.nim) | 0 | ||||
-rw-r--r-- | tests/int/t1.nim (renamed from tests/arithm/t1.nim) | 0 | ||||
-rw-r--r-- | tests/int/tarithm.nim (renamed from tests/arithm/tarithm.nim) | 0 | ||||
-rw-r--r-- | tests/int/tashr.nim (renamed from tests/arithm/tashr.nim) | 0 | ||||
-rw-r--r-- | tests/int/tdiv.nim (renamed from tests/arithm/tdiv.nim) | 0 | ||||
-rw-r--r-- | tests/int/tints.nim (renamed from tests/misc/tints.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsigned64mod.nim (renamed from tests/misc/tunsigned64mod.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsignedcmp.nim (renamed from tests/misc/tunsignedcmp.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsignedcomp.nim (renamed from tests/misc/tunsignedcomp.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsignedconv.nim (renamed from tests/misc/tunsignedconv.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsignedinc.nim (renamed from tests/misc/tunsignedinc.nim) | 0 | ||||
-rw-r--r-- | tests/int/tunsignedmisc.nim (renamed from tests/misc/tunsignedmisc.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/trawstr.nim (renamed from tests/misc/trawstr.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/mambsym1.nim (renamed from tests/ambsym/mambsym1.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/mambsym2.nim (renamed from tests/ambsym/mambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/mambsys1.nim (renamed from tests/ambsym/mambsys1.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/mambsys2.nim (renamed from tests/ambsym/mambsys2.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/mbind3.nim (renamed from tests/bind/mbind3.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tambprocvar.nim (renamed from tests/ambsym/tambprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tambsym.nim (renamed from tests/ambsym/tambsym.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tambsym2.nim (renamed from tests/ambsym/tambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tambsym3.nim (renamed from tests/ambsym/tambsym3.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tambsys.nim (renamed from tests/ambsym/tambsys.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tbind.nim (renamed from tests/bind/tbind.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tgensym.nim (renamed from tests/gensym/tgensym.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tgensymgeneric.nim (renamed from tests/gensym/tgensymgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tinvalidbindtypedesc.nim (renamed from tests/bind/tinvalidbindtypedesc.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tnicerrorforsymchoice.nim (renamed from tests/bind/tnicerrorforsymchoice.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/told_bind_expr.nim (renamed from tests/bind/told_bind_expr.nim) | 0 | ||||
-rw-r--r-- | tests/misc/tgenconstraints.nim | 31 | ||||
-rw-r--r-- | tests/misc/trunner.nim | 2 | ||||
-rw-r--r-- | tests/misc/tstrtabs.nim | 20 | ||||
-rw-r--r-- | tests/msgs/mdeprecated3.nim (renamed from tests/deprecated/importme.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mspellsuggest.nim (renamed from tests/misc/mspellsuggest.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused2a.nim (renamed from tests/pragmas/mused2a.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused2b.nim (renamed from tests/pragmas/mused2b.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused2c.nim (renamed from tests/pragmas/mused2c.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused3.nim (renamed from tests/pragmas/mused3.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused3a.nim (renamed from tests/pragmas/mused3a.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/mused3b.nim (renamed from tests/pragmas/mused3b.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/tdeprecated1.nim | 15 | ||||
-rw-r--r-- | tests/msgs/tdeprecated2.nim (renamed from tests/deprecated/tdeprecated.nim) | 6 | ||||
-rw-r--r-- | tests/msgs/tdeprecated3.nim | 33 | ||||
-rw-r--r-- | tests/msgs/tdeprecatedequalhook.nim (renamed from tests/deprecated/tequalhook.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/texpandmacro.nim (renamed from tests/compilerfeatures/texpandmacro.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/thints_off.nim (renamed from tests/misc/thints_off.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/tspellsuggest.nim (renamed from tests/misc/tspellsuggest.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/tspellsuggest2.nim (renamed from tests/misc/tspellsuggest2.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/tspellsuggest3.nim (renamed from tests/misc/tspellsuggest3.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/tused2.nim (renamed from tests/pragmas/tused2.nim) | 0 | ||||
-rw-r--r-- | tests/msgs/twarningaserror.nim (renamed from tests/misc/twarningaserror.nim) | 0 | ||||
-rw-r--r-- | tests/newconfig/tfoo.nims | 2 | ||||
-rw-r--r-- | tests/overflow/trangechecks.nim (renamed from tests/misc/trangechecks.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tdotlikeoperators.nim (renamed from tests/misc/trfc_341.nim) | 3 | ||||
-rw-r--r-- | tests/proc/mdefaultprocparam.nim (renamed from tests/defaultprocparam/mdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tcolonisproc.nim (renamed from tests/misc/tcolonisproc.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tdefaultprocparam.nim (renamed from tests/defaultprocparam/tdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tlambdadonotation.nim (renamed from tests/misc/tlambdadonotation.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tnamedparams.nim (renamed from tests/namedparams/tnamedparams.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tnamedparams2.nim (renamed from tests/namedparams/tnamedparams2.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tnamedparams3.nim (renamed from tests/namedparams/tnamedparams3.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tparamsindefault.nim (renamed from tests/misc/tparamsindefault.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tprocvar.nim (renamed from tests/procvar/tprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tprocvarmismatch.nim (renamed from tests/procvar/tprocvarmismatch.nim) | 0 | ||||
-rw-r--r-- | tests/sets/tnewsets.nim (renamed from tests/misc/tnewsets.nim) | 0 | ||||
-rw-r--r-- | tests/slice/tdistinct.nim | 2 | ||||
-rw-r--r-- | tests/stdlib/tdistros_detect.nim (renamed from tests/distros/tdistros_detect.nim) | 7 | ||||
-rw-r--r-- | tests/stdlib/tquit.nim | 18 | ||||
-rw-r--r-- | tests/stdlib/trat_float.nim (renamed from tests/rational/trat_float.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/trat_init.nim (renamed from tests/rational/trat_init.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/treadln.nim (renamed from tests/misc/treadln.nim) | 4 | ||||
-rw-r--r-- | tests/stdlib/tstrtabs2.nim | 15 | ||||
-rw-r--r-- | tests/system/t10307.nim (renamed from tests/magics/t10307.nim) | 0 | ||||
-rw-r--r-- | tests/system/t20938.nim (renamed from tests/magics/t20938.nim) | 0 | ||||
-rw-r--r-- | tests/system/tconcat.nim (renamed from tests/concat/tconcat.nim) | 0 | ||||
-rw-r--r-- | tests/system/temptyecho.nim (renamed from tests/misc/temptyecho.nim) | 0 | ||||
-rw-r--r-- | tests/system/tfielditerator.nim (renamed from tests/fields/tfielditerator.nim) | 0 | ||||
-rw-r--r-- | tests/system/tfields.nim (renamed from tests/fields/tfields.nim) | 0 | ||||
-rw-r--r-- | tests/system/tgcregions.nim (renamed from tests/misc/tgcregions.nim) | 0 | ||||
-rw-r--r-- | tests/system/timmutableinc.nim (renamed from tests/misc/tinc.nim) | 2 | ||||
-rw-r--r-- | tests/system/tinvalidnot.nim (renamed from tests/misc/tnot.nim) | 2 | ||||
-rw-r--r-- | tests/system/tlocals.nim (renamed from tests/misc/tlocals.nim) | 0 | ||||
-rw-r--r-- | tests/system/tlowhigh.nim (renamed from tests/misc/tlowhigh.nim) | 0 | ||||
-rw-r--r-- | tests/system/tmagics.nim (renamed from tests/magics/tmagics.nim) | 0 | ||||
-rw-r--r-- | tests/system/tmemory.nim (renamed from tests/stdlib/tmemory.nim) | 0 | ||||
-rw-r--r-- | tests/system/tnew.nim (renamed from tests/misc/tnew.nim) | 8 | ||||
-rw-r--r-- | tests/system/tnewderef.nim (renamed from tests/misc/tnewderef.nim) | 0 | ||||
-rw-r--r-- | tests/system/tslices.nim (renamed from tests/misc/tslices.nim) | 6 | ||||
-rw-r--r-- | tests/template/tidentconcatenations.nim (renamed from tests/misc/tidentconcatenations.nim) | 0 | ||||
-rw-r--r-- | tests/template/twrongmapit.nim | 7 | ||||
-rw-r--r-- | tests/types/tisop.nim | 48 | ||||
-rw-r--r-- | tests/types/tisopr.nim | 30 | ||||
-rw-r--r-- | tests/vm/tcnstseq.nim (renamed from tests/cnstseq/tcnstseq.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tfibconst.nim (renamed from tests/constr/tconexpr.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tnocompiletimefunc.nim (renamed from tests/constr/tnocompiletimefunc.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tnocompiletimefunclambda.nim (renamed from tests/constr/tnocompiletimefunclambda.nim) | 0 |
134 files changed, 189 insertions, 374 deletions
diff --git a/testament/categories.nim b/testament/categories.nim index 946f99fd6..c449cf3e0 100644 --- a/testament/categories.nim +++ b/testament/categories.nim @@ -215,9 +215,9 @@ proc jsTests(r: var TResults, cat: Category, options: string) = for testfile in ["exception/texceptions", "exception/texcpt1", "exception/texcsub", "exception/tfinally", "exception/tfinally2", "exception/tfinally3", - "actiontable/tactiontable", "method/tmultimjs", + "collections/tactiontable", "method/tmultimjs", "varres/tvarres0", "varres/tvarres3", "varres/tvarres4", - "varres/tvartup", "misc/tints", "misc/tunsignedinc", + "varres/tvartup", "int/tints", "int/tunsignedinc", "async/tjsandnativeasync"]: test "tests/" & testfile & ".nim" diff --git a/testament/testament.nim b/testament/testament.nim index 1ed5ef92a..5f443ffba 100644 --- a/testament/testament.nim +++ b/testament/testament.nim @@ -380,7 +380,7 @@ proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest, r.addResult(test, target, extraOptions, expected.nimout, given.nimout, reMsgsDiffer) elif extractFilename(expected.file) != extractFilename(given.file) and "internal error:" notin expected.msg: - r.addResult(test, target, extraOptions, expected.filename, given.file, reFilesDiffer) + r.addResult(test, target, extraOptions, expected.file, given.file, reFilesDiffer) elif expected.line != given.line and expected.line != 0 or expected.column != given.column and expected.column != 0: r.addResult(test, target, extraOptions, $expected.line & ':' & $expected.column, diff --git a/tests/misc/tinvalidarrayaccess.nim b/tests/array/tinvalidarrayaccess.nim index f8bce45ef..f8bce45ef 100644 --- a/tests/misc/tinvalidarrayaccess.nim +++ b/tests/array/tinvalidarrayaccess.nim diff --git a/tests/misc/tinvalidarrayaccess2.nim b/tests/array/tinvalidarrayaccess2.nim index 0a0703834..0a0703834 100644 --- a/tests/misc/tinvalidarrayaccess2.nim +++ b/tests/array/tinvalidarrayaccess2.nim diff --git a/tests/bind/tdatabind.nim b/tests/bind/tdatabind.nim deleted file mode 100644 index f6455749c..000000000 --- a/tests/bind/tdatabind.nim +++ /dev/null @@ -1,95 +0,0 @@ -discard """ - disabled: true -""" - -import events -type - TProperty*[T] = object of TObject - getProc: proc(property: TProperty[T]): T {.nimcall.} - setProc: proc(property: var TProperty[T], value: T) {.nimcall.} - value: T - ValueChanged*: TEventHandler - Binders: seq[TProperty[T]] - EEmitter: TEventEmitter - # Not a descriptive name but it was that or TPropertyValueChangeEventArgs. - TValueEventArgs[T] = object of TEventArgs - Property*: TProperty[T] - - -proc newProperty*[T](value: T): TProperty[T] = - var prop: TProperty[T] - - prop.EEmitter = initEventEmitter() - prop.Binders = @[] - prop.ValueChanged = initEventHandler("ValueChanged") - prop.value = value - - proc getter(property: TProperty[T]): T = - return property.value - - prop.getProc = getter - - proc setter(property: var TProperty[T], v: T) = - property.value = v - - # fire event here - var args: TValueEventArgs[T] - args.Property = property - property.EEmitter.emit(property.ValueChanged, args) - - prop.setProc = setter - - return prop - -proc `prop`[T] (p: TProperty[T]): T = - # I'm assuming this is trying to get a value from the property. - # i.e. myVar = myProperty - return p.getProc(p) - -proc `~=`[T] (p: var TProperty[T], v: T) = - # Assuming this is setting the value. - p.setProc(p, v) - -proc `$`[T] (p: TProperty[T]): string = - var value = p.getProc(p) - return $value - -proc propertyBind*[T](p1: var TProperty[T], p2: var TProperty[T]) = - p1.Binders.add(p2) - - # make handler -> handler[T] so trigger even more generics bugs ... - proc handler(e: TEventArgs) = - type TEA = TValueEventArgs[T] - var args = TEA(e) - var val = args.Property.getProc(p1) - for i in countup(0, len(e.Property.ValueChanged.Binders) -1): - var binded = e.Property.ValueChanged.Binders[i] - binded.setProc(binded, val) - - echo("Property 1 has changed to " & $val) - - if p1.ValueChanged.containsHandler(handler) == false: - addHandler(p1.ValueChanged, handler) - -proc `->`[T](p1: var TProperty[T], p2: var TProperty[T]) = - propertyBind(p2,p1) - -when true: - # Initial value testing - var myProp = newProperty(5) - - echo(myProp) - - myProp ~= 7 # Temp operator until overloading of '=' is implemented. - echo(myProp) - - # Binding testing - - var prop1 = newProperty(9) - var prop2: TProperty[int] - - prop2 -> prop1 # Binds prop2 to prop1 - - prop1 ~= 7 - echo(prop2) # Output: 7 - diff --git a/tests/compilepragma/test.c b/tests/c/tcompile.c index fc0482e40..fc0482e40 100644 --- a/tests/compilepragma/test.c +++ b/tests/c/tcompile.c diff --git a/tests/compilepragma/test.nim b/tests/c/tcompile.nim index 56087fa57..cf99fd7ed 100644 --- a/tests/compilepragma/test.nim +++ b/tests/c/tcompile.nim @@ -3,7 +3,7 @@ discard """ joinable: "false" """ -{.compile: "test.c".} +{.compile: "tcompile.c".} proc foo(a, b: cint): cint {.importc: "foo", cdecl.} diff --git a/tests/misc/temit.nim b/tests/c/temit.nim index ee7455d4c..ee7455d4c 100644 --- a/tests/misc/temit.nim +++ b/tests/c/temit.nim diff --git a/tests/misc/treservedcidentsasfields.nim b/tests/c/treservedcidentsasfields.nim index a9a954651..6cdf9e855 100644 --- a/tests/misc/treservedcidentsasfields.nim +++ b/tests/c/treservedcidentsasfields.nim @@ -1,39 +1,39 @@ -discard """ - targets: "c cpp" -""" - -import macros - -macro make_test_type(idents: varargs[untyped]): untyped = - result = nnkStmtList.newTree() - - var ident_defs: seq[NimNode] = @[] - for i in idents: - ident_defs.add newIdentDefs(i, ident("int")) - - result.add newTree(nnkTypeSection, - newTree(nnkTypeDef, - ident("TestType"), - newEmptyNode(), - newTree(nnkObjectTy, - newEmptyNode(), - newEmptyNode(), - newTree(nnkRecList, - ident_defs - ) - ) - ) - ) - -make_test_type( - auto, bool, catch, char, class, compl, const_cast, default, delete, double, - dynamic_cast, explicit, extern, false, float, friend, goto, int, long, - mutable, namespace, new, operator, private, protected, public, register, - reinterpret_cast, restrict, short, signed, sizeof, static_cast, struct, switch, - this, throw, true, typedef, typeid, typeof, typename, union, packed, unsigned, - virtual, void, volatile, wchar_t, alignas, alignof, constexpr, decltype, nullptr, - noexcept, thread_local, static_assert, char16_t, char32_t -) - -# Make sure the type makes it to codegen. -var test_instance: TestType +discard """ + targets: "c cpp" +""" + +import macros + +macro make_test_type(idents: varargs[untyped]): untyped = + result = nnkStmtList.newTree() + + var ident_defs: seq[NimNode] = @[] + for i in idents: + ident_defs.add newIdentDefs(i, ident("int")) + + result.add newTree(nnkTypeSection, + newTree(nnkTypeDef, + ident("TestType"), + newEmptyNode(), + newTree(nnkObjectTy, + newEmptyNode(), + newEmptyNode(), + newTree(nnkRecList, + ident_defs + ) + ) + ) + ) + +make_test_type( + auto, bool, catch, char, class, compl, const_cast, default, delete, double, + dynamic_cast, explicit, extern, false, float, friend, goto, int, long, + mutable, namespace, new, operator, private, protected, public, register, + reinterpret_cast, restrict, short, signed, sizeof, static_cast, struct, switch, + this, throw, true, typedef, typeid, typeof, typename, union, packed, unsigned, + virtual, void, volatile, wchar_t, alignas, alignof, constexpr, decltype, nullptr, + noexcept, thread_local, static_assert, char16_t, char32_t +) + +# Make sure the type makes it to codegen. +var test_instance: TestType diff --git a/tests/actiontable/tactiontable.nim b/tests/collections/tactiontable.nim index 3f15a70bd..3f15a70bd 100644 --- a/tests/actiontable/tactiontable.nim +++ b/tests/collections/tactiontable.nim diff --git a/tests/config.nims b/tests/config.nims index 3772648e6..842459c3a 100644 --- a/tests/config.nims +++ b/tests/config.nims @@ -36,7 +36,7 @@ switch("define", "nimExperimentalLinenoiseExtra") # preview APIs are expected to be the new default in upcoming versions switch("define", "nimPreviewFloatRoundtrip") -switch("define", "nimPreviewDotLikeOps") +#switch("define", "nimPreviewDotLikeOps") # deprecated? switch("define", "nimPreviewJsonutilsHoleyEnum") switch("define", "nimPreviewHashRef") switch("define", "nimPreviewRangeDefault") diff --git a/tests/constr/a.nim b/tests/constructors/a.nim index 03788fc57..03788fc57 100644 --- a/tests/constr/a.nim +++ b/tests/constructors/a.nim diff --git a/tests/constr/b.nim b/tests/constructors/b.nim index 437dd0550..437dd0550 100644 --- a/tests/constr/b.nim +++ b/tests/constructors/b.nim diff --git a/tests/constr/t18990.nim b/tests/constructors/t18990.nim index 2f60f3c2c..2f60f3c2c 100644 --- a/tests/constr/t18990.nim +++ b/tests/constructors/t18990.nim diff --git a/tests/constr/tconstr1.nim b/tests/constructors/tconstr1.nim index a169bf453..a169bf453 100644 --- a/tests/constr/tconstr1.nim +++ b/tests/constructors/tconstr1.nim diff --git a/tests/constr/tconstr2.nim b/tests/constructors/tconstr2.nim index 2557d7db9..2557d7db9 100644 --- a/tests/constr/tconstr2.nim +++ b/tests/constructors/tconstr2.nim diff --git a/tests/deprecated/tannot.nim b/tests/deprecated/tannot.nim deleted file mode 100644 index d14f6cc23..000000000 --- a/tests/deprecated/tannot.nim +++ /dev/null @@ -1,9 +0,0 @@ -discard """ - nimout: '''tannot.nim(9, 1) Warning: efgh; foo1 is deprecated [Deprecated] -tannot.nim(9, 8) Warning: abcd; foo is deprecated [Deprecated] -''' -""" - -let foo* {.deprecated: "abcd".} = 42 -var foo1* {.deprecated: "efgh".} = 42 -foo1 = foo diff --git a/tests/deprecated/tconst.nim b/tests/deprecated/tconst.nim deleted file mode 100644 index 51eb6cb0e..000000000 --- a/tests/deprecated/tconst.nim +++ /dev/null @@ -1,8 +0,0 @@ -discard """ - nimout: ''' -tconst.nim(8, 9) Warning: abcd; foo is deprecated [Deprecated] -''' -""" - -const foo* {.deprecated: "abcd".} = 42 -discard foo diff --git a/tests/deprecated/tmessages.nim b/tests/deprecated/tmessages.nim deleted file mode 100644 index 5884e396d..000000000 --- a/tests/deprecated/tmessages.nim +++ /dev/null @@ -1,10 +0,0 @@ -discard """ - nimout:'''tmessages.nim(10, 1) Warning: Deprecated since v1.2.0, use 'HelloZ'; hello is deprecated [Deprecated] -''' -""" - -proc hello[T](a: T) {.deprecated: "Deprecated since v1.2.0, use 'HelloZ'".} = - discard - - -hello[int](12) diff --git a/tests/deprecated/tmodule1.nim b/tests/deprecated/tmodule1.nim deleted file mode 100644 index f26e4ce3f..000000000 --- a/tests/deprecated/tmodule1.nim +++ /dev/null @@ -1,33 +0,0 @@ -discard """ - matrix: "--hint:all:off" - nimoutFull: true - nimout: ''' -tmodule1.nim(21, 8) Warning: goodbye; importme is deprecated [Deprecated] -tmodule1.nim(24, 10) Warning: Ty is deprecated [Deprecated] -tmodule1.nim(27, 10) Warning: hello; Ty1 is deprecated [Deprecated] -tmodule1.nim(30, 8) Warning: aVar is deprecated [Deprecated] -tmodule1.nim(32, 3) Warning: aProc is deprecated [Deprecated] -tmodule1.nim(33, 3) Warning: hello; aProc1 is deprecated [Deprecated] -''' -""" - - - - - - - -# line 20 -import importme - -block: - var z: Ty - z = 0 -block: - var z: Ty1 - z = 0 -block: - echo aVar -block: - aProc() - aProc1() diff --git a/tests/borrow/tborrow.nim b/tests/distinct/tborrow.nim index 35652e2e0..35652e2e0 100644 --- a/tests/borrow/tborrow.nim +++ b/tests/distinct/tborrow.nim diff --git a/tests/borrow/tinvalidborrow.nim b/tests/distinct/tinvalidborrow.nim index 08148608d..08148608d 100644 --- a/tests/borrow/tinvalidborrow.nim +++ b/tests/distinct/tinvalidborrow.nim diff --git a/tests/borrow/typeclassborrow.nim b/tests/distinct/typeclassborrow.nim index ee0b07829..ee0b07829 100644 --- a/tests/borrow/typeclassborrow.nim +++ b/tests/distinct/typeclassborrow.nim diff --git a/tests/effects/toutparam.nim b/tests/effects/toutparam.nim deleted file mode 100644 index 1126aa77e..000000000 --- a/tests/effects/toutparam.nim +++ /dev/null @@ -1,28 +0,0 @@ -discard """ - cmd: '''nim c --warningAsError:Uninit:on --skipCfg --skipParentCfg $file''' - errormsg: "use explicit initialization of 'x' for clarity [Uninit]" - line: 24 - disabled: "true" -""" - -proc gah[T](x: out T) = - x = 3 - -proc main = - var a: array[2, int] - var x: int - gah(x) - a[0] = 3 - a[x] = 3 - echo x - -main() - -proc mainB = - var a: array[2, int] - var x: int - a[0] = 3 - a[x] = 3 - echo x - -mainB() diff --git a/tests/clearmsg/mb.nim b/tests/errmsgs/mb.nim index 2d21e2396..2d21e2396 100644 --- a/tests/clearmsg/mb.nim +++ b/tests/errmsgs/mb.nim diff --git a/tests/clearmsg/mc.nim b/tests/errmsgs/mc.nim index 79d7431df..79d7431df 100644 --- a/tests/clearmsg/mc.nim +++ b/tests/errmsgs/mc.nim diff --git a/tests/clearmsg/ta.nim b/tests/errmsgs/ta.nim index 31baae773..31baae773 100644 --- a/tests/clearmsg/ta.nim +++ b/tests/errmsgs/ta.nim diff --git a/tests/clearmsg/tconsttypemismatch.nim b/tests/errmsgs/tconsttypemismatch.nim index 727bfbffb..727bfbffb 100644 --- a/tests/clearmsg/tconsttypemismatch.nim +++ b/tests/errmsgs/tconsttypemismatch.nim diff --git a/tests/clearmsg/tmacroerrorproc.nim b/tests/errmsgs/tmacroerrorproc.nim index 86726af72..86726af72 100644 --- a/tests/clearmsg/tmacroerrorproc.nim +++ b/tests/errmsgs/tmacroerrorproc.nim diff --git a/tests/misc/tnoop.nim b/tests/errmsgs/tnoop.nim index f55f2441a..f55f2441a 100644 --- a/tests/misc/tnoop.nim +++ b/tests/errmsgs/tnoop.nim diff --git a/tests/misc/tsimtych.nim b/tests/errmsgs/tsimpletypecheck.nim index 74a6ad4c0..422437d3a 100644 --- a/tests/misc/tsimtych.nim +++ b/tests/errmsgs/tsimpletypecheck.nim @@ -1,6 +1,6 @@ discard """ errormsg: "type mismatch: got <bool> but expected \'string\'" - file: "tsimtych.nim" + file: "tsimpletypecheck.nim" line: 10 """ # Test 2 diff --git a/tests/friends/mfriends.nim b/tests/generics/mfriends.nim index 19672289e..19672289e 100644 --- a/tests/friends/mfriends.nim +++ b/tests/generics/mfriends.nim diff --git a/tests/constraints/tconstraints.nim b/tests/generics/tconstraints.nim index 3ca01cfd5..3ca01cfd5 100644 --- a/tests/constraints/tconstraints.nim +++ b/tests/generics/tconstraints.nim diff --git a/tests/friends/tfriends.nim b/tests/generics/tfriends.nim index 1e70d50a5..1e70d50a5 100644 --- a/tests/friends/tfriends.nim +++ b/tests/generics/tfriends.nim diff --git a/tests/generics/toverloading_typedesc.nim b/tests/generics/toverloading_typedesc.nim index 5ab700828..4d748bfee 100644 --- a/tests/generics/toverloading_typedesc.nim +++ b/tests/generics/toverloading_typedesc.nim @@ -1,7 +1,3 @@ -discard """ - exitcode: 0 - disabled: '''true''' -""" import moverloading_typedesc import tables @@ -9,7 +5,6 @@ type LFoo = object LBar = object - when true: doAssert FBar.new() == 3 diff --git a/tests/constr/a_module.nim b/tests/global/a_module.nim index 1d3f4848c..1d3f4848c 100644 --- a/tests/constr/a_module.nim +++ b/tests/global/a_module.nim diff --git a/tests/constr/tglobal.nim b/tests/global/tglobal2.nim index 056ac9f81..056ac9f81 100644 --- a/tests/constr/tglobal.nim +++ b/tests/global/tglobal2.nim diff --git a/tests/init/tinitchecks_v2.nim b/tests/init/tinitchecks_v2.nim index 4a8cda028..f7716bcca 100644 --- a/tests/init/tinitchecks_v2.nim +++ b/tests/init/tinitchecks_v2.nim @@ -57,3 +57,27 @@ proc currentlyValid(x: out int; y: out string; cond: bool) = y = "abc" # <-- error: not every path initializes 'y' currentlyValid gl, gs, false + +block: # previously effects/toutparam + proc gah[T](x: out T) = + x = 3 + + proc arr1 = + var a: array[2, int] + var x: int + gah(x) + a[0] = 3 + a[x] = 3 + echo x + + arr1() + + proc arr2 = + var a: array[2, int] + var x: int + a[0] = 3 + a[x] = 3 #[tt.Warning + ^ use explicit initialization of 'x' for clarity [Uninit] ]# + echo x + + arr2() diff --git a/tests/misc/tproveinit.nim b/tests/init/tproveinit.nim index c9f688309..c9f688309 100644 --- a/tests/misc/tproveinit.nim +++ b/tests/init/tproveinit.nim diff --git a/tests/arithm/t1.nim b/tests/int/t1.nim index 36402da07..36402da07 100644 --- a/tests/arithm/t1.nim +++ b/tests/int/t1.nim diff --git a/tests/arithm/tarithm.nim b/tests/int/tarithm.nim index d0943d225..d0943d225 100644 --- a/tests/arithm/tarithm.nim +++ b/tests/int/tarithm.nim diff --git a/tests/arithm/tashr.nim b/tests/int/tashr.nim index aeb3b6843..aeb3b6843 100644 --- a/tests/arithm/tashr.nim +++ b/tests/int/tashr.nim diff --git a/tests/arithm/tdiv.nim b/tests/int/tdiv.nim index 5d8eed84d..5d8eed84d 100644 --- a/tests/arithm/tdiv.nim +++ b/tests/int/tdiv.nim diff --git a/tests/misc/tints.nim b/tests/int/tints.nim index cb77d4d89..cb77d4d89 100644 --- a/tests/misc/tints.nim +++ b/tests/int/tints.nim diff --git a/tests/misc/tunsigned64mod.nim b/tests/int/tunsigned64mod.nim index ca3286df3..ca3286df3 100644 --- a/tests/misc/tunsigned64mod.nim +++ b/tests/int/tunsigned64mod.nim diff --git a/tests/misc/tunsignedcmp.nim b/tests/int/tunsignedcmp.nim index 11b67ac5f..11b67ac5f 100644 --- a/tests/misc/tunsignedcmp.nim +++ b/tests/int/tunsignedcmp.nim diff --git a/tests/misc/tunsignedcomp.nim b/tests/int/tunsignedcomp.nim index 970c4ae9d..970c4ae9d 100644 --- a/tests/misc/tunsignedcomp.nim +++ b/tests/int/tunsignedcomp.nim diff --git a/tests/misc/tunsignedconv.nim b/tests/int/tunsignedconv.nim index c32f85b4d..c32f85b4d 100644 --- a/tests/misc/tunsignedconv.nim +++ b/tests/int/tunsignedconv.nim diff --git a/tests/misc/tunsignedinc.nim b/tests/int/tunsignedinc.nim index 9d1a4bbb4..9d1a4bbb4 100644 --- a/tests/misc/tunsignedinc.nim +++ b/tests/int/tunsignedinc.nim diff --git a/tests/misc/tunsignedmisc.nim b/tests/int/tunsignedmisc.nim index b2a3849cf..b2a3849cf 100644 --- a/tests/misc/tunsignedmisc.nim +++ b/tests/int/tunsignedmisc.nim diff --git a/tests/misc/trawstr.nim b/tests/lexer/trawstr.nim index aa41071d5..aa41071d5 100644 --- a/tests/misc/trawstr.nim +++ b/tests/lexer/trawstr.nim diff --git a/tests/ambsym/mambsym1.nim b/tests/lookups/mambsym1.nim index c4902b1b4..c4902b1b4 100644 --- a/tests/ambsym/mambsym1.nim +++ b/tests/lookups/mambsym1.nim diff --git a/tests/ambsym/mambsym2.nim b/tests/lookups/mambsym2.nim index 21d980073..21d980073 100644 --- a/tests/ambsym/mambsym2.nim +++ b/tests/lookups/mambsym2.nim diff --git a/tests/ambsym/mambsys1.nim b/tests/lookups/mambsys1.nim index 22e54cb94..22e54cb94 100644 --- a/tests/ambsym/mambsys1.nim +++ b/tests/lookups/mambsys1.nim diff --git a/tests/ambsym/mambsys2.nim b/tests/lookups/mambsys2.nim index ef63e4f7e..ef63e4f7e 100644 --- a/tests/ambsym/mambsys2.nim +++ b/tests/lookups/mambsys2.nim diff --git a/tests/bind/mbind3.nim b/tests/lookups/mbind3.nim index 1a7d3b63b..1a7d3b63b 100644 --- a/tests/bind/mbind3.nim +++ b/tests/lookups/mbind3.nim diff --git a/tests/ambsym/tambprocvar.nim b/tests/lookups/tambprocvar.nim index 2a9921bad..2a9921bad 100644 --- a/tests/ambsym/tambprocvar.nim +++ b/tests/lookups/tambprocvar.nim diff --git a/tests/ambsym/tambsym.nim b/tests/lookups/tambsym.nim index bd0f41717..bd0f41717 100644 --- a/tests/ambsym/tambsym.nim +++ b/tests/lookups/tambsym.nim diff --git a/tests/ambsym/tambsym2.nim b/tests/lookups/tambsym2.nim index 747f1a086..747f1a086 100644 --- a/tests/ambsym/tambsym2.nim +++ b/tests/lookups/tambsym2.nim diff --git a/tests/ambsym/tambsym3.nim b/tests/lookups/tambsym3.nim index e50f9c461..e50f9c461 100644 --- a/tests/ambsym/tambsym3.nim +++ b/tests/lookups/tambsym3.nim diff --git a/tests/ambsym/tambsys.nim b/tests/lookups/tambsys.nim index aa740c38f..aa740c38f 100644 --- a/tests/ambsym/tambsys.nim +++ b/tests/lookups/tambsys.nim diff --git a/tests/bind/tbind.nim b/tests/lookups/tbind.nim index f3fb952e3..f3fb952e3 100644 --- a/tests/bind/tbind.nim +++ b/tests/lookups/tbind.nim diff --git a/tests/gensym/tgensym.nim b/tests/lookups/tgensym.nim index e33a2783f..e33a2783f 100644 --- a/tests/gensym/tgensym.nim +++ b/tests/lookups/tgensym.nim diff --git a/tests/gensym/tgensymgeneric.nim b/tests/lookups/tgensymgeneric.nim index 6e1df4842..6e1df4842 100644 --- a/tests/gensym/tgensymgeneric.nim +++ b/tests/lookups/tgensymgeneric.nim diff --git a/tests/bind/tinvalidbindtypedesc.nim b/tests/lookups/tinvalidbindtypedesc.nim index 1c71c8daf..1c71c8daf 100644 --- a/tests/bind/tinvalidbindtypedesc.nim +++ b/tests/lookups/tinvalidbindtypedesc.nim diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/lookups/tnicerrorforsymchoice.nim index 6001b6b09..6001b6b09 100644 --- a/tests/bind/tnicerrorforsymchoice.nim +++ b/tests/lookups/tnicerrorforsymchoice.nim diff --git a/tests/bind/told_bind_expr.nim b/tests/lookups/told_bind_expr.nim index 56389eaf6..56389eaf6 100644 --- a/tests/bind/told_bind_expr.nim +++ b/tests/lookups/told_bind_expr.nim diff --git a/tests/misc/tgenconstraints.nim b/tests/misc/tgenconstraints.nim deleted file mode 100644 index 829da5173..000000000 --- a/tests/misc/tgenconstraints.nim +++ /dev/null @@ -1,31 +0,0 @@ -discard """ - errormsg: "cannot instantiate T2" - file: "tgenconstraints.nim" - line: 25 - disabled: true -""" - -type - T1[T: int|string] = object - x: T - - T2[T: Ordinal] = object - x: T - -var x1: T1[int] -var x2: T1[string] -var x3: T2[int] - -proc foo[T](x: T): T2[T] {.discardable.} = - var o: T1[T] - -foo(10) - -# XXX: allow type intersections in situation like this -proc bar(x: int|TNumber): T1[type(x)] {.discardable.} = - when type(x) is TNumber: - var o: T2[type(x)] - -bar "test" -bar 100 -bar 1.1 diff --git a/tests/misc/trunner.nim b/tests/misc/trunner.nim index 0fc7dcdfd..626b1a886 100644 --- a/tests/misc/trunner.nim +++ b/tests/misc/trunner.nim @@ -404,7 +404,7 @@ running: v2 block: # UnusedImport proc fn(opt: string, expected: string) = - let output = runNimCmdChk("pragmas/mused3.nim", fmt"--warning:all:off --warning:UnusedImport --hint:DuplicateModuleImport {opt}") + let output = runNimCmdChk("msgs/mused3.nim", fmt"--warning:all:off --warning:UnusedImport --hint:DuplicateModuleImport {opt}") doAssert output == expected, opt & "\noutput:\n" & output & "expected:\n" & expected fn("-d:case1"): """ mused3.nim(13, 8) Warning: imported and not used: 'mused3b' [UnusedImport] diff --git a/tests/misc/tstrtabs.nim b/tests/misc/tstrtabs.nim deleted file mode 100644 index 2f7eda9f7..000000000 --- a/tests/misc/tstrtabs.nim +++ /dev/null @@ -1,20 +0,0 @@ -discard """ - targets: "c cpp js" -""" - -import std/strtabs - -proc fun()= - let ret = newStringTable(modeCaseSensitive) - ret["foo"] = "bar" - - doAssert $ret == "{foo: bar}" - - let b = ret["foo"] - doAssert b == "bar" - -proc main()= - static: fun() - fun() - -main() diff --git a/tests/deprecated/importme.nim b/tests/msgs/mdeprecated3.nim index 0a9c6e37d..0a9c6e37d 100644 --- a/tests/deprecated/importme.nim +++ b/tests/msgs/mdeprecated3.nim diff --git a/tests/misc/mspellsuggest.nim b/tests/msgs/mspellsuggest.nim index ad449554f..ad449554f 100644 --- a/tests/misc/mspellsuggest.nim +++ b/tests/msgs/mspellsuggest.nim diff --git a/tests/pragmas/mused2a.nim b/tests/msgs/mused2a.nim index d9b2bb9bf..d9b2bb9bf 100644 --- a/tests/pragmas/mused2a.nim +++ b/tests/msgs/mused2a.nim diff --git a/tests/pragmas/mused2b.nim b/tests/msgs/mused2b.nim index 39c92b964..39c92b964 100644 --- a/tests/pragmas/mused2b.nim +++ b/tests/msgs/mused2b.nim diff --git a/tests/pragmas/mused2c.nim b/tests/msgs/mused2c.nim index a374e634e..a374e634e 100644 --- a/tests/pragmas/mused2c.nim +++ b/tests/msgs/mused2c.nim diff --git a/tests/pragmas/mused3.nim b/tests/msgs/mused3.nim index 0beec1d44..0beec1d44 100644 --- a/tests/pragmas/mused3.nim +++ b/tests/msgs/mused3.nim diff --git a/tests/pragmas/mused3a.nim b/tests/msgs/mused3a.nim index c33d1ecb3..c33d1ecb3 100644 --- a/tests/pragmas/mused3a.nim +++ b/tests/msgs/mused3a.nim diff --git a/tests/pragmas/mused3b.nim b/tests/msgs/mused3b.nim index de288bb08..de288bb08 100644 --- a/tests/pragmas/mused3b.nim +++ b/tests/msgs/mused3b.nim diff --git a/tests/msgs/tdeprecated1.nim b/tests/msgs/tdeprecated1.nim new file mode 100644 index 000000000..f4e85da0b --- /dev/null +++ b/tests/msgs/tdeprecated1.nim @@ -0,0 +1,15 @@ +let foo* {.deprecated: "abcd".} = 42 +var foo1* {.deprecated: "efgh".} = 42 +foo1 = foo #[tt.Warning +^ efgh; foo1 is deprecated [Deprecated]; tt.Warning + ^ abcd; foo is deprecated [Deprecated]]# + +proc hello[T](a: T) {.deprecated: "Deprecated since v1.2.0, use 'HelloZ'".} = + discard + +hello[int](12) #[tt.Warning +^ Deprecated since v1.2.0, use 'HelloZ'; hello is deprecated [Deprecated]]# + +const foo2* {.deprecated: "abcd".} = 42 +discard foo2 #[tt.Warning + ^ abcd; foo2 is deprecated [Deprecated]]# diff --git a/tests/deprecated/tdeprecated.nim b/tests/msgs/tdeprecated2.nim index 51c0dc14b..71d20081e 100644 --- a/tests/deprecated/tdeprecated.nim +++ b/tests/msgs/tdeprecated2.nim @@ -1,8 +1,8 @@ discard """ nimout: ''' -tdeprecated.nim(23, 3) Warning: a is deprecated [Deprecated] -tdeprecated.nim(30, 11) Warning: asdf; enum 'Foo' which contains field 'a' is deprecated [Deprecated] -tdeprecated.nim(40, 16) Warning: use fooX instead; fooA is deprecated [Deprecated] +tdeprecated2.nim(23, 3) Warning: a is deprecated [Deprecated] +tdeprecated2.nim(30, 11) Warning: asdf; enum 'Foo' which contains field 'a' is deprecated [Deprecated] +tdeprecated2.nim(40, 16) Warning: use fooX instead; fooA is deprecated [Deprecated] end ''' """ diff --git a/tests/msgs/tdeprecated3.nim b/tests/msgs/tdeprecated3.nim new file mode 100644 index 000000000..0c1b7deff --- /dev/null +++ b/tests/msgs/tdeprecated3.nim @@ -0,0 +1,33 @@ +discard """ + matrix: "--hint:all:off" + nimoutFull: true + nimout: ''' +tdeprecated3.nim(21, 8) Warning: goodbye; mdeprecated3 is deprecated [Deprecated] +tdeprecated3.nim(24, 10) Warning: Ty is deprecated [Deprecated] +tdeprecated3.nim(27, 10) Warning: hello; Ty1 is deprecated [Deprecated] +tdeprecated3.nim(30, 8) Warning: aVar is deprecated [Deprecated] +tdeprecated3.nim(32, 3) Warning: aProc is deprecated [Deprecated] +tdeprecated3.nim(33, 3) Warning: hello; aProc1 is deprecated [Deprecated] +''' +""" + + + + + + + +# line 20 +import mdeprecated3 + +block: + var z: Ty + z = 0 +block: + var z: Ty1 + z = 0 +block: + echo aVar +block: + aProc() + aProc1() diff --git a/tests/deprecated/tequalhook.nim b/tests/msgs/tdeprecatedequalhook.nim index 79ee835f8..79ee835f8 100644 --- a/tests/deprecated/tequalhook.nim +++ b/tests/msgs/tdeprecatedequalhook.nim diff --git a/tests/compilerfeatures/texpandmacro.nim b/tests/msgs/texpandmacro.nim index fea8b571f..fea8b571f 100644 --- a/tests/compilerfeatures/texpandmacro.nim +++ b/tests/msgs/texpandmacro.nim diff --git a/tests/misc/thints_off.nim b/tests/msgs/thints_off.nim index 5a4cadad6..5a4cadad6 100644 --- a/tests/misc/thints_off.nim +++ b/tests/msgs/thints_off.nim diff --git a/tests/misc/tspellsuggest.nim b/tests/msgs/tspellsuggest.nim index ea0a98cd3..ea0a98cd3 100644 --- a/tests/misc/tspellsuggest.nim +++ b/tests/msgs/tspellsuggest.nim diff --git a/tests/misc/tspellsuggest2.nim b/tests/msgs/tspellsuggest2.nim index 4bf05799e..4bf05799e 100644 --- a/tests/misc/tspellsuggest2.nim +++ b/tests/msgs/tspellsuggest2.nim diff --git a/tests/misc/tspellsuggest3.nim b/tests/msgs/tspellsuggest3.nim index bd4d5256f..bd4d5256f 100644 --- a/tests/misc/tspellsuggest3.nim +++ b/tests/msgs/tspellsuggest3.nim diff --git a/tests/pragmas/tused2.nim b/tests/msgs/tused2.nim index f80c198d8..f80c198d8 100644 --- a/tests/pragmas/tused2.nim +++ b/tests/msgs/tused2.nim diff --git a/tests/misc/twarningaserror.nim b/tests/msgs/twarningaserror.nim index 6f7b76095..6f7b76095 100644 --- a/tests/misc/twarningaserror.nim +++ b/tests/msgs/twarningaserror.nim diff --git a/tests/newconfig/tfoo.nims b/tests/newconfig/tfoo.nims index 0cb950227..f22caaacd 100644 --- a/tests/newconfig/tfoo.nims +++ b/tests/newconfig/tfoo.nims @@ -6,7 +6,7 @@ exec "gcc -v" --define:release --forceBuild ---path: "../friends" +--path: "../generics" warning("uninit", off) diff --git a/tests/misc/trangechecks.nim b/tests/overflow/trangechecks.nim index e48b1272b..e48b1272b 100644 --- a/tests/misc/trangechecks.nim +++ b/tests/overflow/trangechecks.nim diff --git a/tests/misc/trfc_341.nim b/tests/parser/tdotlikeoperators.nim index 37cf675c6..c2d23bd15 100644 --- a/tests/misc/trfc_341.nim +++ b/tests/parser/tdotlikeoperators.nim @@ -1,3 +1,6 @@ +discard """ + matrix: "-d:nimPreviewDotLikeOps" +""" # test for https://github.com/nim-lang/RFCs/issues/341 import std/json import std/jsonutils diff --git a/tests/defaultprocparam/mdefaultprocparam.nim b/tests/proc/mdefaultprocparam.nim index 4a17277c0..4a17277c0 100644 --- a/tests/defaultprocparam/mdefaultprocparam.nim +++ b/tests/proc/mdefaultprocparam.nim diff --git a/tests/misc/tcolonisproc.nim b/tests/proc/tcolonisproc.nim index c10dabcf1..c10dabcf1 100644 --- a/tests/misc/tcolonisproc.nim +++ b/tests/proc/tcolonisproc.nim diff --git a/tests/defaultprocparam/tdefaultprocparam.nim b/tests/proc/tdefaultprocparam.nim index 90edfa8c9..90edfa8c9 100644 --- a/tests/defaultprocparam/tdefaultprocparam.nim +++ b/tests/proc/tdefaultprocparam.nim diff --git a/tests/misc/tlambdadonotation.nim b/tests/proc/tlambdadonotation.nim index 3160c0972..3160c0972 100644 --- a/tests/misc/tlambdadonotation.nim +++ b/tests/proc/tlambdadonotation.nim diff --git a/tests/namedparams/tnamedparams.nim b/tests/proc/tnamedparams.nim index d0774f0d8..d0774f0d8 100644 --- a/tests/namedparams/tnamedparams.nim +++ b/tests/proc/tnamedparams.nim diff --git a/tests/namedparams/tnamedparams2.nim b/tests/proc/tnamedparams2.nim index 9acdeed87..9acdeed87 100644 --- a/tests/namedparams/tnamedparams2.nim +++ b/tests/proc/tnamedparams2.nim diff --git a/tests/namedparams/tnamedparams3.nim b/tests/proc/tnamedparams3.nim index e736c338c..e736c338c 100644 --- a/tests/namedparams/tnamedparams3.nim +++ b/tests/proc/tnamedparams3.nim diff --git a/tests/misc/tparamsindefault.nim b/tests/proc/tparamsindefault.nim index 3fe917f2b..3fe917f2b 100644 --- a/tests/misc/tparamsindefault.nim +++ b/tests/proc/tparamsindefault.nim diff --git a/tests/procvar/tprocvar.nim b/tests/proc/tprocvar.nim index 14f24efdc..14f24efdc 100644 --- a/tests/procvar/tprocvar.nim +++ b/tests/proc/tprocvar.nim diff --git a/tests/procvar/tprocvarmismatch.nim b/tests/proc/tprocvarmismatch.nim index 4d6be9be6..4d6be9be6 100644 --- a/tests/procvar/tprocvarmismatch.nim +++ b/tests/proc/tprocvarmismatch.nim diff --git a/tests/misc/tnewsets.nim b/tests/sets/tnewsets.nim index f239d4aa2..f239d4aa2 100644 --- a/tests/misc/tnewsets.nim +++ b/tests/sets/tnewsets.nim diff --git a/tests/slice/tdistinct.nim b/tests/slice/tdistinct.nim deleted file mode 100644 index d99b529a7..000000000 --- a/tests/slice/tdistinct.nim +++ /dev/null @@ -1,2 +0,0 @@ -type Foo = distinct uint64 -const slice = 0 ..< 42.Foo diff --git a/tests/distros/tdistros_detect.nim b/tests/stdlib/tdistros_detect.nim index 9639cfeb9..1176c8993 100644 --- a/tests/distros/tdistros_detect.nim +++ b/tests/stdlib/tdistros_detect.nim @@ -1,9 +1,4 @@ -import distros - -discard """ - exitcode: 0 - output: "" -""" +import std/[assertions, distros] when defined(windows): doAssert detectOs(Windows) == true diff --git a/tests/stdlib/tquit.nim b/tests/stdlib/tquit.nim deleted file mode 100644 index 12385e57b..000000000 --- a/tests/stdlib/tquit.nim +++ /dev/null @@ -1,18 +0,0 @@ -discard """ -disabled: true -output: ''' -just exiting... -''' -joinable: false -""" - -# Test `addQuitProc` (now deprecated by `addExitProc`) - -import std/syncio - -proc myExit() {.noconv.} = - write(stdout, "just exiting...\n") - -{.push warning[deprecated]: off.} -addQuitProc(myExit) -{.pop.} diff --git a/tests/rational/trat_float.nim b/tests/stdlib/trat_float.nim index 663973bf9..663973bf9 100644 --- a/tests/rational/trat_float.nim +++ b/tests/stdlib/trat_float.nim diff --git a/tests/rational/trat_init.nim b/tests/stdlib/trat_init.nim index 2be0c0099..2be0c0099 100644 --- a/tests/rational/trat_init.nim +++ b/tests/stdlib/trat_init.nim diff --git a/tests/misc/treadln.nim b/tests/stdlib/treadln.nim index b716c4711..4a070e848 100644 --- a/tests/misc/treadln.nim +++ b/tests/stdlib/treadln.nim @@ -6,6 +6,8 @@ Macintosh, Unix or Windows text format. ''' """ +import std/syncio + # test the improved readline handling that does not care whether its # Macintosh, Unix or Windows text format. @@ -13,7 +15,7 @@ var inp: File line: string -if open(inp, "tests/misc/treadln.nim"): +if open(inp, "tests/stdlib/treadln.nim"): while not endOfFile(inp): line = readLine(inp) if line.len >= 2 and line[0] == '#' and line[1] == ' ': diff --git a/tests/stdlib/tstrtabs2.nim b/tests/stdlib/tstrtabs2.nim index aeef28d65..a4030ec77 100644 --- a/tests/stdlib/tstrtabs2.nim +++ b/tests/stdlib/tstrtabs2.nim @@ -15,3 +15,18 @@ block: doAssert t["name"] == "John" m() + +proc fun()= + let ret = newStringTable(modeCaseSensitive) + ret["foo"] = "bar" + + doAssert $ret == "{foo: bar}" + + let b = ret["foo"] + doAssert b == "bar" + +proc main()= + static: fun() + fun() + +main() diff --git a/tests/magics/t10307.nim b/tests/system/t10307.nim index b5a93c5c6..b5a93c5c6 100644 --- a/tests/magics/t10307.nim +++ b/tests/system/t10307.nim diff --git a/tests/magics/t20938.nim b/tests/system/t20938.nim index 7341cbb91..7341cbb91 100644 --- a/tests/magics/t20938.nim +++ b/tests/system/t20938.nim diff --git a/tests/concat/tconcat.nim b/tests/system/tconcat.nim index fdce3ea00..fdce3ea00 100644 --- a/tests/concat/tconcat.nim +++ b/tests/system/tconcat.nim diff --git a/tests/misc/temptyecho.nim b/tests/system/temptyecho.nim index a3c407897..a3c407897 100644 --- a/tests/misc/temptyecho.nim +++ b/tests/system/temptyecho.nim diff --git a/tests/fields/tfielditerator.nim b/tests/system/tfielditerator.nim index d1fbf02f9..d1fbf02f9 100644 --- a/tests/fields/tfielditerator.nim +++ b/tests/system/tfielditerator.nim diff --git a/tests/fields/tfields.nim b/tests/system/tfields.nim index 0bf3a4e1a..0bf3a4e1a 100644 --- a/tests/fields/tfields.nim +++ b/tests/system/tfields.nim diff --git a/tests/misc/tgcregions.nim b/tests/system/tgcregions.nim index e14865be3..e14865be3 100644 --- a/tests/misc/tgcregions.nim +++ b/tests/system/tgcregions.nim diff --git a/tests/misc/tinc.nim b/tests/system/timmutableinc.nim index 91f6223e2..e857800b3 100644 --- a/tests/misc/tinc.nim +++ b/tests/system/timmutableinc.nim @@ -1,6 +1,6 @@ discard """ errormsg: "type mismatch: got <int>" - file: "tinc.nim" + file: "timmutableinc.nim" line: 8 """ var x = 0 diff --git a/tests/misc/tnot.nim b/tests/system/tinvalidnot.nim index a3669705b..df0291a8a 100644 --- a/tests/misc/tnot.nim +++ b/tests/system/tinvalidnot.nim @@ -1,6 +1,6 @@ discard """ errormsg: "type mismatch" - file: "tnot.nim" + file: "tinvalidnot.nim" line: 14 """ # BUG: following compiles, but should not: diff --git a/tests/misc/tlocals.nim b/tests/system/tlocals.nim index e59976102..e59976102 100644 --- a/tests/misc/tlocals.nim +++ b/tests/system/tlocals.nim diff --git a/tests/misc/tlowhigh.nim b/tests/system/tlowhigh.nim index 6ae871255..6ae871255 100644 --- a/tests/misc/tlowhigh.nim +++ b/tests/system/tlowhigh.nim diff --git a/tests/magics/tmagics.nim b/tests/system/tmagics.nim index e52912b74..e52912b74 100644 --- a/tests/magics/tmagics.nim +++ b/tests/system/tmagics.nim diff --git a/tests/stdlib/tmemory.nim b/tests/system/tmemory.nim index 553037011..553037011 100644 --- a/tests/stdlib/tmemory.nim +++ b/tests/system/tmemory.nim diff --git a/tests/misc/tnew.nim b/tests/system/tnew.nim index 41ef3fa19..c28c1187f 100644 --- a/tests/misc/tnew.nim +++ b/tests/system/tnew.nim @@ -1,5 +1,5 @@ discard """ -matrix: "--mm:refc" +matrix: "--mm:refc; --mm:orc" outputsub: ''' Simple tree node allocation worked! Simple cycle allocation worked! @@ -11,7 +11,6 @@ joinable: false # and the code generation for gc walkers # (and the garbage collector): -## todo fixme it doesn't work for ORC type PNode = ref TNode TNode = object @@ -26,7 +25,10 @@ proc finalizer(n: PNode) = write(stdout, " is now freed\n") proc newNode(data: int, le, ri: PNode): PNode = - new(result, finalizer) + when defined(gcDestructors): # using finalizer breaks the test for orc + new(result) + else: + new(result, finalizer) result.le = le result.ri = ri result.data = data diff --git a/tests/misc/tnewderef.nim b/tests/system/tnewderef.nim index 3394dbddf..3394dbddf 100644 --- a/tests/misc/tnewderef.nim +++ b/tests/system/tnewderef.nim diff --git a/tests/misc/tslices.nim b/tests/system/tslices.nim index 987b50de1..d0c68f8cb 100644 --- a/tests/misc/tslices.nim +++ b/tests/system/tslices.nim @@ -57,3 +57,9 @@ echo mystr var s = "abcdef" s[1 .. ^2] = "xyz" assert s == "axyzf" + +# issue mentioned in PR #19219 +type Foo = distinct uint64 +# < here calls `pred` which used to cause a codegen error +# `pred` compiles because distinct ordinals are considered ordinal +const slice = 0 ..< 42.Foo diff --git a/tests/misc/tidentconcatenations.nim b/tests/template/tidentconcatenations.nim index ddd2e49cc..ddd2e49cc 100644 --- a/tests/misc/tidentconcatenations.nim +++ b/tests/template/tidentconcatenations.nim diff --git a/tests/template/twrongmapit.nim b/tests/template/twrongmapit.nim index 13f53d119..2d53d03f5 100644 --- a/tests/template/twrongmapit.nim +++ b/tests/template/twrongmapit.nim @@ -1,9 +1,6 @@ discard """ - disabled: true - output: "####" + joinable: false """ -# unfortunately our tester doesn't support multiple lines of compiler -# error messages yet... # bug #1562 type Foo* {.pure, final.} = object @@ -30,4 +27,4 @@ import sequtils (var i = @[""];i).applyIt(it) # now works: -echo "##", i[0], "##" +doAssert i[0] == "" diff --git a/tests/types/tisop.nim b/tests/types/tisop.nim deleted file mode 100644 index 5f9cba0d8..000000000 --- a/tests/types/tisop.nim +++ /dev/null @@ -1,48 +0,0 @@ -discard """ - disabled: true -""" - -import typetraits - -type - TRecord = (tuple) or (object) - - TFoo[T, U] = object - x: int - - when T is string: - y: float - else: - y: string - - when U is TRecord: - z: float - - E = enum A, B, C - -macro m(t: typedesc): typedesc = - if t is enum: - result = string - else: - result = int - -var f: TFoo[int, int] -static: doAssert(f.y.type.name == "string") - -when compiles(f.z): - {.error: "Foo should not have a `z` field".} - -proc p(a, b: auto) = - when a.type is int: - static: doAssert false - - var f: TFoo[m(a.type), b.type] - static: - doAssert f.x.type.name == "int" - echo f.y.type.name - doAssert f.y.type.name == "float" - echo f.z.type.name - doAssert f.z.type.name == "float" - -p(A, f) - diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim index 67f1ce0c1..64b3d03c0 100644 --- a/tests/types/tisopr.nim +++ b/tests/types/tisopr.nim @@ -135,3 +135,33 @@ block: let Q = MyObj[P](y: 2) doAssert($Q == "(y: 2)") +block: # previously tisop.nim + type + TRecord = (tuple) or (object) + TFoo[T, U] = object + x: int + when T is string: + y: float + else: + y: string + when U is TRecord: + z: float + E = enum A, B, C + template m(t: typedesc): typedesc = + when t is enum: + string + else: + int + var f: TFoo[int, int] + static: doAssert(typeof(f.y) is string) + when compiles(f.z): + {.error: "Foo should not have a `z` field".} + proc p(a, b: auto) = + when typeof(a) is int: + static: doAssert false + var f: TFoo[m(a.typeof), b.typeof] + static: + doAssert f.x.typeof is int + doAssert f.y.typeof is float + doAssert f.z.typeof is float + p(A, f) diff --git a/tests/cnstseq/tcnstseq.nim b/tests/vm/tcnstseq.nim index 5679a6e37..5679a6e37 100644 --- a/tests/cnstseq/tcnstseq.nim +++ b/tests/vm/tcnstseq.nim diff --git a/tests/constr/tconexpr.nim b/tests/vm/tfibconst.nim index cca6dd84f..cca6dd84f 100644 --- a/tests/constr/tconexpr.nim +++ b/tests/vm/tfibconst.nim diff --git a/tests/constr/tnocompiletimefunc.nim b/tests/vm/tnocompiletimefunc.nim index a95648c0f..a95648c0f 100644 --- a/tests/constr/tnocompiletimefunc.nim +++ b/tests/vm/tnocompiletimefunc.nim diff --git a/tests/constr/tnocompiletimefunclambda.nim b/tests/vm/tnocompiletimefunclambda.nim index d134eea40..d134eea40 100644 --- a/tests/constr/tnocompiletimefunclambda.nim +++ b/tests/vm/tnocompiletimefunclambda.nim |