diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actiontable/tactiontable.nim (renamed from tests/run/tactiontable.nim) | 0 | ||||
-rw-r--r-- | tests/actiontable/tactiontable2.nim (renamed from tests/reject/tactiontable2.nim) | 14 | ||||
-rw-r--r-- | tests/alias/talias.nim (renamed from tests/compile/talias.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsym1.nim (renamed from tests/reject/mambsym1.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsym2.nim (renamed from tests/reject/mambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsys1.nim (renamed from tests/run/mambsys1.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsys2.nim (renamed from tests/run/mambsys2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym.nim (renamed from tests/reject/tambsym.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym2.nim (renamed from tests/run/tambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym3.nim (renamed from tests/reject/tambsym3.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsys.nim (renamed from tests/run/tambsys.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray.nim (renamed from tests/run/tarray.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray2.nim (renamed from tests/run/tarray2.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray3.nim (renamed from tests/run/tarray3.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarraycons.nim (renamed from tests/reject/tarraycons.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarraycons2.nim (renamed from tests/run/tarraycons.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarrayplus.nim (renamed from tests/reject/tarrayplus.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarrindx.nim (renamed from tests/compile/tarrindx.nim) | 0 | ||||
-rw-r--r-- | tests/assert/tassert.nim (renamed from tests/run/tassert.nim) | 0 | ||||
-rw-r--r-- | tests/assert/tfailedassert.nim | 51 | ||||
-rw-r--r-- | tests/assert/tunittests.nim | 1 | ||||
-rw-r--r-- | tests/assert/tuserassert.nim (renamed from tests/run/tuserassert.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tassign.nim (renamed from tests/compile/tassign.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tcopy.nim (renamed from tests/run/tcopy.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tgenericassign.nim (renamed from tests/run/tgenericassign.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tgenericassigntuples.nim (renamed from tests/run/tgenericassigntuples.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tobjasgn.nim (renamed from tests/run/tobjasgn.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tvariantasgn.nim (renamed from tests/run/tvariantasgn.nim) | 0 | ||||
-rw-r--r-- | tests/astoverload/tastoverload1.nim (renamed from tests/run/tastoverload1.nim) | 0 | ||||
-rw-r--r-- | tests/async/tasynciossl.nim (renamed from tests/run/tasynciossl.nim) | 0 | ||||
-rw-r--r-- | tests/async/tasyncudp.nim (renamed from tests/run/tasyncudp.nim) | 0 | ||||
-rw-r--r-- | tests/bind/mbind3.nim (renamed from tests/run/mbind3.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbind1.nim (renamed from tests/run/tbind1.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbind2.nim (renamed from tests/reject/tbind2.nim) | 2 | ||||
-rw-r--r-- | tests/bind/tbind3.nim (renamed from tests/run/tbind3.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbindoverload.nim (renamed from tests/compile/tbindoverload.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbindtypedesc.nim (renamed from tests/reject/tbindtypedesc.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tdatabind.nim (renamed from tests/compile/tdatabind.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tmixin.nim (renamed from tests/run/tmixin.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tnicerrorforsymchoice.nim (renamed from tests/reject/tnicerrorforsymchoice.nim) | 0 | ||||
-rw-r--r-- | tests/borrow/tborrow.nim (renamed from tests/run/tborrow.nim) | 0 | ||||
-rw-r--r-- | tests/borrow/tinvalidborrow.nim (renamed from tests/reject/tinvalidborrow.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcase_setconstr.nim (renamed from tests/run/tcase_setconstr.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseexpr1.nim (renamed from tests/reject/tcaseexpr1.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseoverlaprange.nim (renamed from tests/reject/tcaseoverlaprange.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseoverlaprange2.nim (renamed from tests/reject/tcaseoverlaprange2.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcasestm.nim (renamed from tests/run/tcasestm.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcomputedgoto.nim (renamed from tests/compile/tcomputedgoto.nim) | 31 | ||||
-rw-r--r-- | tests/casestmt/tlinearscanend.nim (renamed from tests/compile/tlinearscanend.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tccgen1.nim (renamed from tests/compile/tccgen1.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tcgbug.nim (renamed from tests/run/tcgbug.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tcodegenbug1.nim (renamed from tests/compile/tcodegenbug1.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure.nim (renamed from tests/run/tclosure.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure2.nim (renamed from tests/run/tclosure2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure3.nim (renamed from tests/run/tclosure3.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure4.nim (renamed from tests/compile/tclosure4.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosurebug2.nim (renamed from tests/compile/tclosurebug2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinterf.nim (renamed from tests/run/tinterf.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinvalidclosure.nim (renamed from tests/reject/tinvalidclosure.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinvalidclosure2.nim (renamed from tests/reject/tinvalidclosure2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tnamedparamanonproc.nim (renamed from tests/compile/tnamedparamanonproc.nim) | 4 | ||||
-rw-r--r-- | tests/closure/tnestedproc.nim (renamed from tests/compile/tnestedproc.nim) | 0 | ||||
-rw-r--r-- | tests/closure/uclosures.nim (renamed from tests/run/uclosures.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq.nim (renamed from tests/run/tcnstseq.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq2.nim (renamed from tests/run/tcnstseq2.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq3.nim (renamed from tests/run/tcnstseq3.nim) | 0 | ||||
-rw-r--r-- | tests/compile/mvarious.nim | 6 | ||||
-rw-r--r-- | tests/compile/sunset.tmpl | 68 | ||||
-rw-r--r-- | tests/compile/tambsym2.nim | 6 | ||||
-rw-r--r-- | tests/compile/tbindtypedesc.nim | 87 | ||||
-rw-r--r-- | tests/compile/tcmdline.nim | 14 | ||||
-rw-r--r-- | tests/compile/tcolonisproc.nim | 12 | ||||
-rw-r--r-- | tests/compile/tdllvar.nim | 16 | ||||
-rw-r--r-- | tests/compile/temptyecho.nim | 2 | ||||
-rw-r--r-- | tests/compile/tendian.nim | 3 | ||||
-rw-r--r-- | tests/compile/tfib.nim | 11 | ||||
-rw-r--r-- | tests/compile/tgenericshardcases.nim | 30 | ||||
-rw-r--r-- | tests/compile/tgetstartmilsecs.nim | 7 | ||||
-rw-r--r-- | tests/compile/tgtk.nim | 51 | ||||
-rw-r--r-- | tests/compile/thallo.nim | 85 | ||||
-rw-r--r-- | tests/compile/theaproots.nim | 71 | ||||
-rw-r--r-- | tests/compile/tlastmod.nim | 18 | ||||
-rw-r--r-- | tests/compile/tlibs.nim | 24 | ||||
-rw-r--r-- | tests/compile/tloops.nim | 87 | ||||
-rw-r--r-- | tests/compile/tmandelbrot.nim | 57 | ||||
-rw-r--r-- | tests/compile/tnew.nim | 49 | ||||
-rw-r--r-- | tests/compile/tnewlibs.nim | 17 | ||||
-rw-r--r-- | tests/compile/tnewsets.nim | 6 | ||||
-rw-r--r-- | tests/compile/tnewuns.nim | 12 | ||||
-rw-r--r-- | tests/compile/tnoforward.nim | 10 | ||||
-rw-r--r-- | tests/compile/tparedef.nim | 4 | ||||
-rw-r--r-- | tests/compile/tprep.nim | 30 | ||||
-rw-r--r-- | tests/compile/tquicksort.nim | 26 | ||||
-rw-r--r-- | tests/compile/tradix.nim | 319 | ||||
-rw-r--r-- | tests/compile/treadln.nim | 12 | ||||
-rw-r--r-- | tests/compile/treadx.nim | 14 | ||||
-rw-r--r-- | tests/compile/tshadow_magic_type.nim | 24 | ||||
-rw-r--r-- | tests/compile/tsizeof.nim | 10 | ||||
-rw-r--r-- | tests/compile/tstrace.nim | 16 | ||||
-rw-r--r-- | tests/compile/tstrdesc.nim | 14 | ||||
-rw-r--r-- | tests/compile/tstrdist.nim | 26 | ||||
-rw-r--r-- | tests/compile/tvarious.nim | 63 | ||||
-rw-r--r-- | tests/compiles/tcompiles.nim (renamed from tests/compile/tcompiles.nim) | 0 | ||||
-rw-r--r-- | tests/concat/tconcat.nim (renamed from tests/run/tconcat.nim) | 0 | ||||
-rw-r--r-- | tests/concurrency/tnodeadlocks.nim (renamed from tests/run/tnodeadlocks.nim) | 0 | ||||
-rw-r--r-- | tests/constr/tconstr1.nim (renamed from tests/reject/tconstr1.nim) | 0 | ||||
-rw-r--r-- | tests/constr/tconstr2.nim (renamed from tests/run/tconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/constraints/tconstraints.nim (renamed from tests/reject/tconstraints.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tblock1.nim (renamed from tests/reject/tblock1.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tcontinue.nim (renamed from tests/run/tcontinue.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tnestif.nim (renamed from tests/run/tnestif.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tstatret.nim (renamed from tests/reject/tstatret.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tconvcolors.nim (renamed from tests/compile/tconvcolors.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tconvert.nim (renamed from tests/compile/tconvert.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tgenericconverter.nim (renamed from tests/run/tgenericconverter.nim) | 0 | ||||
-rw-r--r-- | tests/converter/ttypeconverter1.nim (renamed from tests/compile/ttypeconverter1.nim) | 0 | ||||
-rw-r--r-- | tests/defaultprocparam/mdefaultprocparam.nim (renamed from tests/compile/mdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/defaultprocparam/tdefaultprocparam.nim (renamed from tests/compile/tdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/deprecated/tdeprecated.nim (renamed from tests/reject/tdeprecated.nim) | 0 | ||||
-rw-r--r-- | tests/destructor/tdestructor.nim | 84 | ||||
-rw-r--r-- | tests/destructor/tdestructor2.nim (renamed from tests/reject/tdestructor.nim) | 0 | ||||
-rw-r--r-- | tests/destructor/tdictdestruct.nim (renamed from tests/compile/tdictdestruct.nim) | 0 | ||||
-rw-r--r-- | tests/discard/tdiscardable.nim (renamed from tests/compile/tdiscardable.nim) | 0 | ||||
-rw-r--r-- | tests/discard/tneedsdiscard.nim (renamed from tests/reject/tneedsdiscard.nim) | 0 | ||||
-rw-r--r-- | tests/distinct/tcurrncy.nim (renamed from tests/run/tcurrncy.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects1.nim (renamed from tests/reject/teffects1.nim) | 2 | ||||
-rw-r--r-- | tests/effects/teffects2.nim (renamed from tests/reject/teffects2.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects3.nim (renamed from tests/reject/teffects3.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects4.nim (renamed from tests/reject/teffects4.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects5.nim (renamed from tests/reject/teffects5.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects6.nim (renamed from tests/compile/teffects1.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee1.nim (renamed from tests/reject/tsidee1.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee2.nim (renamed from tests/run/tsidee2.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee3.nim (renamed from tests/run/tsidee3.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee4.nim (renamed from tests/reject/tsidee4.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum.nim (renamed from tests/compile/tenum.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum2.nim (renamed from tests/compile/tenum2.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum3.nim (renamed from tests/compile/tenum3.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumhole.nim (renamed from tests/run/tenumhole.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumitems.nim (renamed from tests/reject/tenumitems.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumitems2.nim (renamed from tests/run/tenumitems.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenummix.nim (renamed from tests/reject/tenummix.nim) | 4 | ||||
-rw-r--r-- | tests/enum/tnamedenumfields.nim (renamed from tests/run/tnamedenumfields.nim) | 0 | ||||
-rw-r--r-- | tests/enum/toptions.nim (renamed from tests/compile/toptions.nim) | 4 | ||||
-rw-r--r-- | tests/exception/tcontinuexc.nim (renamed from tests/run/tcontinuexc.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texceptions.nim (renamed from tests/run/texceptions.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texcpt1.nim (renamed from tests/run/texcpt1.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texcsub.nim (renamed from tests/run/texcsub.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally.nim (renamed from tests/run/tfinally.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally2.nim (renamed from tests/run/tfinally2.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally3.nim (renamed from tests/run/tfinally3.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tonraise.nim (renamed from tests/run/tonraise.nim) | 0 | ||||
-rw-r--r-- | tests/exception/treraise.nim (renamed from tests/run/treraise.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tunhandledexc.nim (renamed from tests/run/tunhandledexc.nim) | 0 | ||||
-rw-r--r-- | tests/exception/twrongexc.nim (renamed from tests/run/twrongexc.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/texprstmt.nim (renamed from tests/reject/texprstmt.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/tstmtexp.nim (renamed from tests/reject/tstmtexp.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/tstmtexprs.nim (renamed from tests/run/tstmtexprs.nim) | 0 | ||||
-rw-r--r-- | tests/fields/tfieldindex.nim (renamed from tests/run/tfieldindex.nim) | 0 | ||||
-rw-r--r-- | tests/fields/tfielditerator.nim (renamed from tests/run/tfielditerator.nim) | 0 | ||||
-rw-r--r-- | tests/fields/tfielditerator2.nim (renamed from tests/run/tfielditerator2.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat1.nim (renamed from tests/run/tfloat1.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat2.nim (renamed from tests/run/tfloat2.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat3.nim (renamed from tests/run/tfloat3.nim) | 0 | ||||
-rw-r--r-- | tests/friends/mfriends.nim (renamed from tests/run/mfriends.nim) | 0 | ||||
-rw-r--r-- | tests/friends/tfriends.nim (renamed from tests/run/tfriends.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tbintre2.nim (renamed from tests/run/tbintre2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tbintree.nim (renamed from tests/run/tbintree.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_alias_generic.nim (renamed from tests/compile/tcan_alias_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_alias_specialised_generic.nim (renamed from tests/compile/tcan_alias_specialised_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_inherit_generic.nim (renamed from tests/compile/tcan_inherit_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_specialise_generic.nim (renamed from tests/compile/tcan_specialise_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/texplicitgeneric1.nim (renamed from tests/run/texplicitgeneric1.nim) | 0 | ||||
-rw-r--r-- | tests/generics/texplicitgeneric2.nim (renamed from tests/run/texplicitgeneric2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tforwardgeneric.nim (renamed from tests/compile/tforwardgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric0.nim (renamed from tests/compile/tgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric1.nim (renamed from tests/run/tgenerics1.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric2.nim (renamed from tests/compile/tgeneric2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric3.nim (renamed from tests/compile/tgeneric3.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric4.nim (renamed from tests/compile/tgeneric4.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericdefaults.nim (renamed from tests/compile/tgenericdefaults.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericmatcher.nim (renamed from tests/compile/tgenericmatcher.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericmatcher2.nim (renamed from tests/compile/tgenericmatcher2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericprocvar.nim (renamed from tests/run/tgenericprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericprop.nim (renamed from tests/compile/tgenericprop.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericrefs.nim (renamed from tests/compile/tgenericrefs.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericshardcases.nim | 36 | ||||
-rw-r--r-- | tests/generics/tgenerictmpl.nim (renamed from tests/compile/tgenerictmpl.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericvariant.nim (renamed from tests/compile/tgenericvariant.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tspecialised_is_equivalent.nim (renamed from tests/compile/tspecialised_is_equivalent.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tthread_generic.nim (renamed from tests/compile/tthread_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tvarargs_vs_generic.nim (renamed from tests/run/tvarargs_vs_generic.nim) | 0 | ||||
-rw-r--r-- | tests/gensym/tgensym.nim (renamed from tests/run/tgensym.nim) | 0 | ||||
-rw-r--r-- | tests/gensym/tgensymgeneric.nim (renamed from tests/compile/tgensymgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/global/tglobal.nim (renamed from tests/run/tglobal.nim) | 0 | ||||
-rw-r--r-- | tests/global/tglobalforvar.nim (renamed from tests/compile/tglobalforvar.nim) | 0 | ||||
-rw-r--r-- | tests/implicit/timplicititems.nim (renamed from tests/compile/timplicititems.nim) | 0 | ||||
-rw-r--r-- | tests/implicit/timplictderef.nim (renamed from tests/compile/timplictderef.nim) | 0 | ||||
-rw-r--r-- | tests/init/tuninit1.nim (renamed from tests/reject/tuninit1.nim) | 0 | ||||
-rw-r--r-- | tests/init/tzeroarray.nim (renamed from tests/run/tzeroarray.nim) | 0 | ||||
-rw-r--r-- | tests/iter/tanoniter1.nim | 32 | ||||
-rw-r--r-- | tests/iter/tcountup.nim (renamed from tests/run/tcountup.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer.nim (renamed from tests/compile/titer.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer2.nim (renamed from tests/compile/titer2.nim) | 2 | ||||
-rw-r--r-- | tests/iter/titer3.nim (renamed from tests/run/titer3.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer4.nim (renamed from tests/reject/titer4.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer5.nim (renamed from tests/run/titer5.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer6.nim (renamed from tests/run/titer6.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer7.nim (renamed from tests/run/titer7.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer8.nim (renamed from tests/run/titer8.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer9.nim (renamed from tests/run/titer9.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer_no_tuple_unpack.nim (renamed from tests/compile/titer_no_tuple_unpack.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titerovl.nim (renamed from tests/compile/titerovl.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titerslice.nim (renamed from tests/run/titerslice.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titervaropenarray.nim (renamed from tests/run/titervaropenarray.nim) | 0 | ||||
-rw-r--r-- | tests/iter/tmoditer.nim (renamed from tests/run/tmoditer.nim) | 0 | ||||
-rw-r--r-- | tests/iter/treciter.nim (renamed from tests/reject/treciter.nim) | 0 | ||||
-rw-r--r-- | tests/iter/twrongiter.nim (renamed from tests/reject/twrongiter.nim) | 2 | ||||
-rw-r--r-- | tests/let/tlet.nim (renamed from tests/reject/tlet.nim) | 0 | ||||
-rw-r--r-- | tests/let/tlet2.nim (renamed from tests/reject/tlet2.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/thexlit.nim (renamed from tests/run/thexlit.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/thexrange.nim (renamed from tests/compile/thexrange.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tident.nim (renamed from tests/compile/tident.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tind1.nim (renamed from tests/reject/tind1.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tindent1.nim (renamed from tests/run/tindent1.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tlexer.nim (renamed from tests/compile/tlexer.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tmissingnl.nim (renamed from tests/reject/tmissingnl.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tstrlits.nim (renamed from tests/run/tstrlits.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tunderscores.nim (renamed from tests/reject/tunderscores.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tkoeniglookup.nim (renamed from tests/run/tkoeniglookup.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tredef.nim (renamed from tests/compile/tredef.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tdumpast.nim (renamed from tests/compile/tdumpast.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tdumpast2.nim (renamed from tests/compile/tdumpast2.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tdumptree.nim (renamed from tests/run/tdumptree.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tidgen.nim (renamed from tests/run/tidgen.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro1.nim (renamed from tests/compile/tmacro1.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro2.nim (renamed from tests/run/tmacro2.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro3.nim (renamed from tests/run/tmacro3.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro4.nim (renamed from tests/run/tmacro4.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro5.nim (renamed from tests/compile/tmacro2.nim) | 2 | ||||
-rw-r--r-- | tests/macros/tmacroaspragma.nim (renamed from tests/compile/tmacroaspragma.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrogenerics.nim (renamed from tests/run/tmacrogenerics.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacros1.nim (renamed from tests/run/tmacros1.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrostmt.nim (renamed from tests/compile/tmacrostmt.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrotypes.nim (renamed from tests/compile/tmacrotypes.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmemit.nim | 7 | ||||
-rw-r--r-- | tests/macros/tnimrodnode_for_runtime.nim (renamed from tests/compile/tnimrodnode_for_runtime.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tprintf.nim (renamed from tests/run/tprintf.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tquotewords.nim (renamed from tests/run/tquotewords.nim) | 0 | ||||
-rw-r--r-- | tests/macros/trecmacro.nim (renamed from tests/reject/trecmacro.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tstringinterp.nim (renamed from tests/run/tstringinterp.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tvtable.nim (renamed from tests/run/tvtable.nim) | 0 | ||||
-rw-r--r-- | tests/magics/tlowhigh.nim (renamed from tests/run/tlowhigh.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix.nim (renamed from tests/run/tmatrix.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix1.nim (renamed from tests/compile/tmatrix1.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix2.nim (renamed from tests/compile/tmatrix2.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tbindtypedesc.nim | 91 | ||||
-rw-r--r-- | tests/metatype/tcompositetypeclasses.nim | 59 | ||||
-rw-r--r-- | tests/metatype/tconstraints.nim (renamed from tests/compile/tconstraints.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tsemistatic.nim | 24 | ||||
-rw-r--r-- | tests/metatype/tstaticparams.nim (renamed from tests/run/tstaticparams.nim) | 16 | ||||
-rw-r--r-- | tests/metatype/ttypebar.nim | 14 | ||||
-rw-r--r-- | tests/metatype/ttypeclasses.nim (renamed from tests/compile/ttypeclasses.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypedesc1.nim (renamed from tests/run/ttypedesc1.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypeselectors.nim (renamed from tests/compile/ttypeselectors.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypetraits.nim (renamed from tests/run/ttypetraits.nim) | 2 | ||||
-rw-r--r-- | tests/metatype/tusertypeclasses.nim (renamed from tests/run/tusertypeclasses.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/utypeclasses.nim (renamed from tests/run/utypeclasses.nim) | 0 | ||||
-rw-r--r-- | tests/method/mmultim3.nim (renamed from tests/run/mmultim3.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmethod.nim (renamed from tests/reject/tmethod.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmethods1.nim (renamed from tests/run/tmethods1.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim1.nim (renamed from tests/run/tmultim1.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim2.nim (renamed from tests/run/tmultim2.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim3.nim (renamed from tests/run/tmultim3.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim4.nim (renamed from tests/run/tmultim4.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim6.nim (renamed from tests/run/tmultim6.nim) | 0 | ||||
-rw-r--r-- | tests/method/tsimmeth.nim (renamed from tests/run/tsimmeth.nim) | 0 | ||||
-rw-r--r-- | tests/module/mopaque.nim (renamed from tests/reject/mopaque.nim) | 0 | ||||
-rw-r--r-- | tests/module/mrecmod.nim (renamed from tests/compile/mrecmod.nim) | 0 | ||||
-rw-r--r-- | tests/module/mrecmod2.nim (renamed from tests/compile/mrecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/module/topaque.nim (renamed from tests/reject/topaque.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecinca.nim (renamed from tests/reject/trecinca.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecincb.nim (renamed from tests/reject/trecincb.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecmod.nim (renamed from tests/compile/trecmod.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecmod2.nim (renamed from tests/compile/trecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mexporta.nim (renamed from tests/compile/mexporta.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mexportb.nim (renamed from tests/compile/mexportb.nim) | 0 | ||||
-rw-r--r-- | tests/modules/texport.nim (renamed from tests/compile/texport.nim) | 0 | ||||
-rw-r--r-- | tests/modules/timportexcept.nim (renamed from tests/reject/timportexcept.nim) | 0 | ||||
-rw-r--r-- | tests/namedparams/tnamedparams.nim (renamed from tests/reject/tnamedparams.nim) | 0 | ||||
-rw-r--r-- | tests/namedparams/tnamedparams2.nim (renamed from tests/compile/tnamedparams.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/mnamspc1.nim (renamed from tests/reject/mnamspc1.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/mnamspc2.nim (renamed from tests/reject/mnamspc2.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/tnamspc.nim (renamed from tests/reject/tnamspc.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil.nim (renamed from tests/reject/tnotnil.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil1.nim (renamed from tests/reject/tnotnil1.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil2.nim (renamed from tests/reject/tnotnil2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr.nim (renamed from tests/run/tobjconstr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr2.nim (renamed from tests/compile/tobjconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjcov.nim (renamed from tests/compile/tobjcov.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject.nim (renamed from tests/run/tobject.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject2.nim (renamed from tests/compile/tobject2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject3.nim (renamed from tests/compile/tobject3.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjects.nim (renamed from tests/compile/tobjects.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tofopr.nim (renamed from tests/run/tofopr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop.nim (renamed from tests/compile/toop.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop1.nim (renamed from tests/run/toop1.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tadrdisc.nim (renamed from tests/reject/tadrdisc.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tcheckedfield1.nim (renamed from tests/reject/tcheckedfield1.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/temptycaseobj.nim (renamed from tests/reject/temptycaseobj.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tvariantstack.nim (renamed from tests/run/tvariantstack.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topena1.nim (renamed from tests/reject/topena1.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topenarrayrepr.nim (renamed from tests/run/topenarrayrepr.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topenlen.nim (renamed from tests/run/topenlen.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/toverflw.nim (renamed from tests/run/toverflw.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/toverflw2.nim (renamed from tests/run/toverflw2.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/tovfint.nim (renamed from tests/run/tovfint.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl.nim (renamed from tests/reject/toverl.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl2.nim (renamed from tests/run/toverl2.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl3.nim (renamed from tests/run/toverl3.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverprc.nim (renamed from tests/compile/toverprc.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverwr.nim (renamed from tests/run/toverwr.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tcommand_as_expr.nim | 12 | ||||
-rw-r--r-- | tests/parser/tdomulttest.nim (renamed from tests/run/tdomulttest.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tinvwhen.nim (renamed from tests/reject/tinvwhen.nim) | 4 | ||||
-rw-r--r-- | tests/parser/toprprec.nim (renamed from tests/run/toprprec.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tprecedence.nim (renamed from tests/run/tprecedence.nim) | 0 | ||||
-rw-r--r-- | tests/patterns/tor.nim | 2 | ||||
-rw-r--r-- | tests/patterns/tpatterns.nim (renamed from tests/run/tpatterns.nim) | 0 | ||||
-rw-r--r-- | tests/pragmas/tpush.nim (renamed from tests/compile/tpush.nim) | 0 | ||||
-rw-r--r-- | tests/pragmas/tuserpragma.nim (renamed from tests/compile/tuserpragma.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tnestprc.nim (renamed from tests/run/tnestprc.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tprocredef.nim (renamed from tests/reject/tprocredef.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tgenericprocvar.nim (renamed from tests/compile/tgenericprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvar.nim (renamed from tests/reject/tprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvar2.nim (renamed from tests/run/tprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvars.nim (renamed from tests/compile/tprocvars.nim) | 0 | ||||
-rw-r--r-- | tests/range/compilehelpers.nim | 6 | ||||
-rw-r--r-- | tests/range/tbug499771.nim (renamed from tests/run/tbug499771.nim) | 0 | ||||
-rw-r--r-- | tests/range/tcolors.nim (renamed from tests/compile/tcolors.nim) | 0 | ||||
-rw-r--r-- | tests/range/tmatrix3.nim | 41 | ||||
-rw-r--r-- | tests/range/tsubrange.nim (renamed from tests/reject/tsubrange.nim) | 0 | ||||
-rw-r--r-- | tests/range/tsubrange2.nim (renamed from tests/run/tsubrange2.nim) | 0 | ||||
-rw-r--r-- | tests/range/tsubrange3.nim (renamed from tests/run/tsubrange.nim) | 0 | ||||
-rw-r--r-- | tests/reject/99bottles.nim | 1 | ||||
-rw-r--r-- | tests/reject/mbind4.nim | 9 | ||||
-rw-r--r-- | tests/reject/t99bott.nim | 36 | ||||
-rw-r--r-- | tests/reject/tatomic.nim | 12 | ||||
-rw-r--r-- | tests/reject/tbind4.nim | 13 | ||||
-rw-r--r-- | tests/reject/tgenconstraints.nim | 30 | ||||
-rw-r--r-- | tests/reject/tinc.nim | 12 | ||||
-rw-r--r-- | tests/reject/tinout.nim | 16 | ||||
-rw-r--r-- | tests/reject/tinvalidarrayaccess.nim | 14 | ||||
-rw-r--r-- | tests/reject/tinvalidnewseq.nim | 27 | ||||
-rw-r--r-- | tests/reject/tnoinst.nim | 16 | ||||
-rw-r--r-- | tests/reject/tnolen.nim | 9 | ||||
-rw-r--r-- | tests/reject/tnoop.nim | 12 | ||||
-rw-r--r-- | tests/reject/tnot.nim | 21 | ||||
-rw-r--r-- | tests/reject/trawstr.nim | 12 | ||||
-rw-r--r-- | tests/reject/tsimtych.nim | 12 | ||||
-rw-r--r-- | tests/run/globalaux.nim | 15 | ||||
-rw-r--r-- | tests/run/globalaux2.nim | 4 | ||||
-rw-r--r-- | tests/run/minit.nim | 2 | ||||
-rw-r--r-- | tests/run/tack.nim | 21 | ||||
-rw-r--r-- | tests/run/tbug511622.nim | 16 | ||||
-rw-r--r-- | tests/run/tdestructor.nim | 26 | ||||
-rw-r--r-- | tests/run/temit.nim | 20 | ||||
-rw-r--r-- | tests/run/teventemitter.nim | 33 | ||||
-rw-r--r-- | tests/run/tevents.nim | 48 | ||||
-rw-r--r-- | tests/run/tfilter.nim | 41 | ||||
-rw-r--r-- | tests/run/thintoff.nim | 12 | ||||
-rw-r--r-- | tests/run/tinit.nim | 12 | ||||
-rw-r--r-- | tests/run/tints.nim | 45 | ||||
-rw-r--r-- | tests/run/tlocals.nim | 11 | ||||
-rw-r--r-- | tests/run/tmemoization.nim | 17 | ||||
-rw-r--r-- | tests/run/tnewderef.nim | 11 | ||||
-rw-r--r-- | tests/run/tpos.nim | 35 | ||||
-rw-r--r-- | tests/run/tromans.nim | 71 | ||||
-rw-r--r-- | tests/run/tsimplesort.nim | 313 | ||||
-rw-r--r-- | tests/run/tslices.nim | 59 | ||||
-rw-r--r-- | tests/run/tsortdev.nim | 59 | ||||
-rw-r--r-- | tests/run/tstrange.nim | 23 | ||||
-rw-r--r-- | tests/run/tunittests.nim | 1 | ||||
-rw-r--r-- | tests/run/tvarious1.nim | 41 | ||||
-rw-r--r-- | tests/run/tvarnums.nim | 142 | ||||
-rw-r--r-- | tests/seq/tseq2.nim (renamed from tests/compile/tseq2.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqcon.nim (renamed from tests/run/tseqcon.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqcon2.nim (renamed from tests/compile/tseqcon2.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqtuple.nim (renamed from tests/run/tseqtuple.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tsequtils.nim (renamed from tests/run/tsequtils.nim) | 0 | ||||
-rw-r--r-- | tests/seq/ttoseq.nim (renamed from tests/run/ttoseq.nim) | 0 | ||||
-rw-r--r-- | tests/sets/tsets.nim (renamed from tests/run/tsets.nim) | 0 | ||||
-rw-r--r-- | tests/sets/tsets2.nim (renamed from tests/run/tsets2.nim) | 0 | ||||
-rw-r--r-- | tests/showoff/tdrdobbs_examples.nim (renamed from tests/run/tdrdobbs_examples.nim) | 0 | ||||
-rw-r--r-- | tests/showoff/tformatopt.nim | 57 | ||||
-rw-r--r-- | tests/showoff/thello2.nim | 11 | ||||
-rw-r--r-- | tests/showoff/thtml1.nim | 11 | ||||
-rw-r--r-- | tests/showoff/thtml2.nim | 37 | ||||
-rw-r--r-- | tests/showoff/tonce.nim | 22 | ||||
-rw-r--r-- | tests/showoff/tquasiquote.nim | 14 | ||||
-rw-r--r-- | tests/stdlib/tcputime.nim (renamed from tests/compile/tcputime.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tcritbits.nim (renamed from tests/run/tcritbits.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tdialogs.nim (renamed from tests/compile/tdialogs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/techo.nim (renamed from tests/compile/techo.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tformat.nim (renamed from tests/run/tformat.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/thashes.nim (renamed from tests/run/thashes.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tio.nim (renamed from tests/compile/tio.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tircbot.nim (renamed from tests/compile/tircbot.nim) | 6 | ||||
-rw-r--r-- | tests/stdlib/tlists.nim (renamed from tests/run/tlists.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmarshal.nim (renamed from tests/compile/tmarshal.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmath.nim (renamed from tests/run/tmath.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmath2.nim (renamed from tests/compile/tmath.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmongo.nim (renamed from tests/compile/tmongo.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tos.nim (renamed from tests/compile/tos.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparscfg.nim (renamed from tests/compile/tparscfg.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparsefloat.nim (renamed from tests/compile/tparsefloat.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparsopt.nim (renamed from tests/compile/tparsopt.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tpegs.nim (renamed from tests/run/tpegs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tposix.nim (renamed from tests/compile/tposix.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tquit.nim (renamed from tests/compile/tquit.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tregex.nim (renamed from tests/run/tregex.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/treguse.nim (renamed from tests/run/treguse.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/trepr.nim (renamed from tests/run/trepr.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/trepr2.nim (renamed from tests/compile/trepr.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsockets.nim (renamed from tests/compile/tsockets.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsortcall.nim (renamed from tests/compile/tsortcall.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsplit.nim (renamed from tests/run/tsplit.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstreams.nim (renamed from tests/compile/tstreams.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrset.nim (renamed from tests/compile/tstrset.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrtabs.nim (renamed from tests/compile/tstrtabs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrutil.nim (renamed from tests/run/tstrutil.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/ttime.nim (renamed from tests/compile/ttime.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tunidecode.nim (renamed from tests/run/tunidecode.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/twalker.nim (renamed from tests/compile/twalker.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/txmlgen.nim (renamed from tests/run/txmlgen.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/txmltree.nim (renamed from tests/run/txmltree.nim) | 0 | ||||
-rw-r--r-- | tests/table/ttableconstr.nim (renamed from tests/compile/ttableconstr.nim) | 0 | ||||
-rw-r--r-- | tests/table/ttables.nim (renamed from tests/run/ttables.nim) | 0 | ||||
-rw-r--r-- | tests/table/ttables2.nim (renamed from tests/run/ttables2.nim) | 0 | ||||
-rw-r--r-- | tests/template/mcan_access_hidden_field.nim | 9 | ||||
-rw-r--r-- | tests/template/mtempl5.nim (renamed from tests/compile/mtempl5.nim) | 0 | ||||
-rw-r--r-- | tests/template/tcan_access_hidden_field.nim | 9 | ||||
-rw-r--r-- | tests/template/thygienictempl.nim (renamed from tests/compile/thygienictempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/tmodulealias.nim (renamed from tests/compile/tmodulealias.nim) | 0 | ||||
-rw-r--r-- | tests/template/tstempl.nim (renamed from tests/run/tstempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl.nim (renamed from tests/compile/ttempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl2.nim (renamed from tests/reject/ttempl2.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl3.nim (renamed from tests/compile/ttempl3.nim) | 2 | ||||
-rw-r--r-- | tests/template/ttempl4.nim (renamed from tests/compile/ttempl4.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl5.nim (renamed from tests/compile/ttempl5.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttemplreturntype.nim (renamed from tests/compile/ttemplreturntype.nim) | 0 | ||||
-rw-r--r-- | tests/template/utemplates.nim (renamed from tests/run/utemplates.nim) | 2 | ||||
-rw-r--r-- | tests/testament/backend.nim | 121 | ||||
-rw-r--r-- | tests/testament/caasdriver.nim (renamed from tests/caasdriver.nim) | 0 | ||||
-rw-r--r-- | tests/testament/categories.nim | 264 | ||||
-rw-r--r-- | tests/testament/css/boilerplate.css (renamed from tests/css/boilerplate.css) | 0 | ||||
-rw-r--r-- | tests/testament/css/style.css (renamed from tests/css/style.css) | 0 | ||||
-rw-r--r-- | tests/testament/htmlgen.nim | 161 | ||||
-rw-r--r-- | tests/testament/specs.nim | 130 | ||||
-rw-r--r-- | tests/testament/tester.nim | 273 | ||||
-rw-r--r-- | tests/trmacros/tdisallowif.nim (renamed from tests/reject/tdisallowif.nim) | 3 | ||||
-rw-r--r-- | tests/tuples/tanontuples.nim (renamed from tests/run/tanontuples.nim) | 0 | ||||
-rw-r--r-- | tests/tuples/twrongtupleaccess.nim (renamed from tests/reject/twrongtupleaccess.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tcommontype.nim (renamed from tests/compile/tcommontype.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tno_int_in_bool_context.nim (renamed from tests/reject/tno_int_in_bool_context.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tnoargopenarray.nim (renamed from tests/compile/tnoargopenarray.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tnocontains.nim (renamed from tests/reject/tnocontains.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectuple.nim (renamed from tests/compile/trectuple.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectuples.nim (renamed from tests/compile/trectuples.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectype.nim (renamed from tests/reject/trectype.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trefs.nim (renamed from tests/reject/trefs.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trettypeinference.nim (renamed from tests/run/trettypeinference.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tsecondarrayproperty.nim (renamed from tests/compile/tsecondarrayproperty.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttuple1.nim (renamed from tests/compile/ttuple1.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypelessemptyset.nim (renamed from tests/reject/ttypelessemptyset.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypenoval.nim (renamed from tests/reject/ttypenoval.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypenovalue.nim (renamed from tests/reject/ttypenovalue.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tvoid.nim (renamed from tests/compile/tvoid.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/typalias.nim (renamed from tests/compile/typalias.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/typredef.nim (renamed from tests/reject/typredef.nim) | 6 | ||||
-rw-r--r-- | tests/types/tfinalobj.nim (renamed from tests/run/tfinalobj.nim) | 0 | ||||
-rw-r--r-- | tests/types/tforwty.nim (renamed from tests/compile/tforwty.nim) | 0 | ||||
-rw-r--r-- | tests/types/tforwty2.nim (renamed from tests/compile/tforwty2.nim) | 0 | ||||
-rw-r--r-- | tests/types/tillegaltyperecursion.nim (renamed from tests/reject/tillegaltyperecursion.nim) | 0 | ||||
-rw-r--r-- | tests/types/tillrec.nim (renamed from tests/reject/tillrec.nim) | 19 | ||||
-rw-r--r-- | tests/types/tinheritref.nim (renamed from tests/compile/tinheritref.nim) | 0 | ||||
-rw-r--r-- | tests/types/tisop.nim (renamed from tests/compile/tisop.nim) | 0 | ||||
-rw-r--r-- | tests/types/tisopr.nim (renamed from tests/run/tisopr.nim) | 0 | ||||
-rw-r--r-- | tests/usingstmt/tusingstatement.nim (renamed from tests/run/tusingstatement.nim) | 24 | ||||
-rw-r--r-- | tests/varres/tvarres1.nim (renamed from tests/reject/tvarres1.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres2.nim (renamed from tests/reject/tvarres2.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres3.nim (renamed from tests/run/tvarres1.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres4.nim (renamed from tests/run/tvarres2.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvartup.nim (renamed from tests/run/tvartup.nim) | 0 | ||||
-rw-r--r-- | tests/varstmt/tlet.nim (renamed from tests/run/tlet.nim) | 0 | ||||
-rw-r--r-- | tests/varstmt/tvardecl.nim (renamed from tests/run/tvardecl.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tconsteval.nim (renamed from tests/compile/tconsteval.nim) | 0 | ||||
-rw-r--r-- | tests/vm/teval1.nim (renamed from tests/compile/teval1.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tslurp.nim (renamed from tests/compile/tslurp.nim) | 0 | ||||
-rw-r--r-- | tests/vm/twrongconst.nim (renamed from tests/reject/twrongconst.nim) | 4 |
500 files changed, 1646 insertions, 2725 deletions
diff --git a/tests/run/tactiontable.nim b/tests/actiontable/tactiontable.nim index e2f19a099..e2f19a099 100644 --- a/tests/run/tactiontable.nim +++ b/tests/actiontable/tactiontable.nim diff --git a/tests/reject/tactiontable2.nim b/tests/actiontable/tactiontable2.nim index dbfa42f18..00b427603 100644 --- a/tests/reject/tactiontable2.nim +++ b/tests/actiontable/tactiontable2.nim @@ -5,23 +5,23 @@ discard """ import tables -proc action1(arg: string) = +proc action1(arg: string) = echo "action 1 ", arg -proc action2(arg: string) = +proc action2(arg: string) = echo "action 2 ", arg -proc action3(arg: string) = +proc action3(arg: string) = echo "action 3 ", arg -proc action4(arg: string) = +proc action4(arg: string) = echo "action 4 ", arg const actionTable = { - "A": action1, - "B": action2, - "C": action3, + "A": action1, + "B": action2, + "C": action3, "D": action4}.toTable actionTable["C"]("arg") diff --git a/tests/compile/talias.nim b/tests/alias/talias.nim index 819289c2e..819289c2e 100644 --- a/tests/compile/talias.nim +++ b/tests/alias/talias.nim diff --git a/tests/reject/mambsym1.nim b/tests/ambsym/mambsym1.nim index cf8ac5242..cf8ac5242 100644 --- a/tests/reject/mambsym1.nim +++ b/tests/ambsym/mambsym1.nim diff --git a/tests/reject/mambsym2.nim b/tests/ambsym/mambsym2.nim index eac8de6ba..eac8de6ba 100644 --- a/tests/reject/mambsym2.nim +++ b/tests/ambsym/mambsym2.nim diff --git a/tests/run/mambsys1.nim b/tests/ambsym/mambsys1.nim index 5472b5ae4..5472b5ae4 100644 --- a/tests/run/mambsys1.nim +++ b/tests/ambsym/mambsys1.nim diff --git a/tests/run/mambsys2.nim b/tests/ambsym/mambsys2.nim index 395425b86..395425b86 100644 --- a/tests/run/mambsys2.nim +++ b/tests/ambsym/mambsys2.nim diff --git a/tests/reject/tambsym.nim b/tests/ambsym/tambsym.nim index 902274648..902274648 100644 --- a/tests/reject/tambsym.nim +++ b/tests/ambsym/tambsym.nim diff --git a/tests/run/tambsym2.nim b/tests/ambsym/tambsym2.nim index 745427c54..745427c54 100644 --- a/tests/run/tambsym2.nim +++ b/tests/ambsym/tambsym2.nim diff --git a/tests/reject/tambsym3.nim b/tests/ambsym/tambsym3.nim index 0155f258c..0155f258c 100644 --- a/tests/reject/tambsym3.nim +++ b/tests/ambsym/tambsym3.nim diff --git a/tests/run/tambsys.nim b/tests/ambsym/tambsys.nim index 67522d7c9..67522d7c9 100644 --- a/tests/run/tambsys.nim +++ b/tests/ambsym/tambsys.nim diff --git a/tests/run/tarray.nim b/tests/array/tarray.nim index 16ef558d1..16ef558d1 100644 --- a/tests/run/tarray.nim +++ b/tests/array/tarray.nim diff --git a/tests/run/tarray2.nim b/tests/array/tarray2.nim index b6adabb45..b6adabb45 100644 --- a/tests/run/tarray2.nim +++ b/tests/array/tarray2.nim diff --git a/tests/run/tarray3.nim b/tests/array/tarray3.nim index d28778357..d28778357 100644 --- a/tests/run/tarray3.nim +++ b/tests/array/tarray3.nim diff --git a/tests/reject/tarraycons.nim b/tests/array/tarraycons.nim index 7de518b6e..7de518b6e 100644 --- a/tests/reject/tarraycons.nim +++ b/tests/array/tarraycons.nim diff --git a/tests/run/tarraycons.nim b/tests/array/tarraycons2.nim index 0b2a42c2f..0b2a42c2f 100644 --- a/tests/run/tarraycons.nim +++ b/tests/array/tarraycons2.nim diff --git a/tests/reject/tarrayplus.nim b/tests/array/tarrayplus.nim index 8c7452e85..8c7452e85 100644 --- a/tests/reject/tarrayplus.nim +++ b/tests/array/tarrayplus.nim diff --git a/tests/compile/tarrindx.nim b/tests/array/tarrindx.nim index 13919cc2c..13919cc2c 100644 --- a/tests/compile/tarrindx.nim +++ b/tests/array/tarrindx.nim diff --git a/tests/run/tassert.nim b/tests/assert/tassert.nim index 0ea8d2034..0ea8d2034 100644 --- a/tests/run/tassert.nim +++ b/tests/assert/tassert.nim diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim new file mode 100644 index 000000000..263893767 --- /dev/null +++ b/tests/assert/tfailedassert.nim @@ -0,0 +1,51 @@ +discard """ + output: ''' +WARNING: false first asseertion from bar +ERROR: false second assertion from bar +-1 +tests/assert/tfailedassert.nim:27 false assertion from foo +''' +""" + +type + TLineInfo = tuple[filename: string, line: int] + + TMyError = object of E_Base + lineinfo: TLineInfo + + EMyError = ref TMyError + +# module-wide policy to change the failed assert +# exception type in order to include a lineinfo +onFailedAssert(msg): + var e = new(TMyError) + e.msg = msg + e.lineinfo = instantiationInfo(-2) + raise e + +proc foo = + assert(false, "assertion from foo") + +proc bar: int = + # local overrides that are active only + # in this proc + onFailedAssert(msg): echo "WARNING: " & msg + + assert(false, "first asseertion from bar") + + onFailedAssert(msg): + echo "ERROR: " & msg + return -1 + + assert(false, "second assertion from bar") + return 10 + +echo("") +echo(bar()) + +try: + foo() +except: + let e = EMyError(getCurrentException()) + echo e.lineinfo.filename, ":", e.lineinfo.line, " ", e.msg + diff --git a/tests/assert/tunittests.nim b/tests/assert/tunittests.nim new file mode 100644 index 000000000..cbbfe63c6 --- /dev/null +++ b/tests/assert/tunittests.nim @@ -0,0 +1 @@ +import "../template/utemplates", "../closure/uclosures" diff --git a/tests/run/tuserassert.nim b/tests/assert/tuserassert.nim index 8710ee486..8710ee486 100644 --- a/tests/run/tuserassert.nim +++ b/tests/assert/tuserassert.nim diff --git a/tests/compile/tassign.nim b/tests/assign/tassign.nim index f51c20783..f51c20783 100644 --- a/tests/compile/tassign.nim +++ b/tests/assign/tassign.nim diff --git a/tests/run/tcopy.nim b/tests/assign/tcopy.nim index 5feb0d6b3..5feb0d6b3 100644 --- a/tests/run/tcopy.nim +++ b/tests/assign/tcopy.nim diff --git a/tests/run/tgenericassign.nim b/tests/assign/tgenericassign.nim index 654b0ab8f..654b0ab8f 100644 --- a/tests/run/tgenericassign.nim +++ b/tests/assign/tgenericassign.nim diff --git a/tests/run/tgenericassigntuples.nim b/tests/assign/tgenericassigntuples.nim index 6dd63a984..6dd63a984 100644 --- a/tests/run/tgenericassigntuples.nim +++ b/tests/assign/tgenericassigntuples.nim diff --git a/tests/run/tobjasgn.nim b/tests/assign/tobjasgn.nim index 5f411063f..5f411063f 100644 --- a/tests/run/tobjasgn.nim +++ b/tests/assign/tobjasgn.nim diff --git a/tests/run/tvariantasgn.nim b/tests/assign/tvariantasgn.nim index 46cc23dd1..46cc23dd1 100644 --- a/tests/run/tvariantasgn.nim +++ b/tests/assign/tvariantasgn.nim diff --git a/tests/run/tastoverload1.nim b/tests/astoverload/tastoverload1.nim index c8705547a..c8705547a 100644 --- a/tests/run/tastoverload1.nim +++ b/tests/astoverload/tastoverload1.nim diff --git a/tests/run/tasynciossl.nim b/tests/async/tasynciossl.nim index fbed46efb..fbed46efb 100644 --- a/tests/run/tasynciossl.nim +++ b/tests/async/tasynciossl.nim diff --git a/tests/run/tasyncudp.nim b/tests/async/tasyncudp.nim index fd7f3d568..fd7f3d568 100644 --- a/tests/run/tasyncudp.nim +++ b/tests/async/tasyncudp.nim diff --git a/tests/run/mbind3.nim b/tests/bind/mbind3.nim index d02bc79d0..d02bc79d0 100644 --- a/tests/run/mbind3.nim +++ b/tests/bind/mbind3.nim diff --git a/tests/run/tbind1.nim b/tests/bind/tbind1.nim index 6593b2307..6593b2307 100644 --- a/tests/run/tbind1.nim +++ b/tests/bind/tbind1.nim diff --git a/tests/reject/tbind2.nim b/tests/bind/tbind2.nim index 72a9844bb..e8e21ad02 100644 --- a/tests/reject/tbind2.nim +++ b/tests/bind/tbind2.nim @@ -1,6 +1,6 @@ discard """ file: "tbind2.nim" - line: 12 + line: 14 errormsg: "ambiguous call" """ # Test the new ``bind`` keyword for templates diff --git a/tests/run/tbind3.nim b/tests/bind/tbind3.nim index 551acc10f..551acc10f 100644 --- a/tests/run/tbind3.nim +++ b/tests/bind/tbind3.nim diff --git a/tests/compile/tbindoverload.nim b/tests/bind/tbindoverload.nim index 6f5bb339e..6f5bb339e 100644 --- a/tests/compile/tbindoverload.nim +++ b/tests/bind/tbindoverload.nim diff --git a/tests/reject/tbindtypedesc.nim b/tests/bind/tbindtypedesc.nim index d6fbae537..d6fbae537 100644 --- a/tests/reject/tbindtypedesc.nim +++ b/tests/bind/tbindtypedesc.nim diff --git a/tests/compile/tdatabind.nim b/tests/bind/tdatabind.nim index afa8aa47b..afa8aa47b 100644 --- a/tests/compile/tdatabind.nim +++ b/tests/bind/tdatabind.nim diff --git a/tests/run/tmixin.nim b/tests/bind/tmixin.nim index d841326a5..d841326a5 100644 --- a/tests/run/tmixin.nim +++ b/tests/bind/tmixin.nim diff --git a/tests/reject/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim index bc271dcab..bc271dcab 100644 --- a/tests/reject/tnicerrorforsymchoice.nim +++ b/tests/bind/tnicerrorforsymchoice.nim diff --git a/tests/run/tborrow.nim b/tests/borrow/tborrow.nim index 8e6aeba74..8e6aeba74 100644 --- a/tests/run/tborrow.nim +++ b/tests/borrow/tborrow.nim diff --git a/tests/reject/tinvalidborrow.nim b/tests/borrow/tinvalidborrow.nim index 9ab9e8d64..9ab9e8d64 100644 --- a/tests/reject/tinvalidborrow.nim +++ b/tests/borrow/tinvalidborrow.nim diff --git a/tests/run/tcase_setconstr.nim b/tests/casestmt/tcase_setconstr.nim index 21f657c2b..21f657c2b 100644 --- a/tests/run/tcase_setconstr.nim +++ b/tests/casestmt/tcase_setconstr.nim diff --git a/tests/reject/tcaseexpr1.nim b/tests/casestmt/tcaseexpr1.nim index e5e08e25e..e5e08e25e 100644 --- a/tests/reject/tcaseexpr1.nim +++ b/tests/casestmt/tcaseexpr1.nim diff --git a/tests/reject/tcaseoverlaprange.nim b/tests/casestmt/tcaseoverlaprange.nim index 5f24c3ca9..5f24c3ca9 100644 --- a/tests/reject/tcaseoverlaprange.nim +++ b/tests/casestmt/tcaseoverlaprange.nim diff --git a/tests/reject/tcaseoverlaprange2.nim b/tests/casestmt/tcaseoverlaprange2.nim index d6e301508..d6e301508 100644 --- a/tests/reject/tcaseoverlaprange2.nim +++ b/tests/casestmt/tcaseoverlaprange2.nim diff --git a/tests/run/tcasestm.nim b/tests/casestmt/tcasestm.nim index 003ec6e50..003ec6e50 100644 --- a/tests/run/tcasestm.nim +++ b/tests/casestmt/tcasestm.nim diff --git a/tests/compile/tcomputedgoto.nim b/tests/casestmt/tcomputedgoto.nim index 2c3b4bbd4..b21fc07a3 100644 --- a/tests/compile/tcomputedgoto.nim +++ b/tests/casestmt/tcomputedgoto.nim @@ -1,16 +1,16 @@ discard """ - output: '''yeah A -yeah A -yeah CD -yeah CD -yeah A -yeah CD -yeah CD -yeah A -yeah B -yeah A -yeah A -yeah A''' + output: '''yeah A enumB +yeah A enumB +yeah CD enumD +yeah CD enumE +yeah A enumB +yeah CD enumE +yeah CD enumD +yeah A enumB +yeah B enumC +yeah A enumB +yeah A enumB +yeah A enumB''' """ type @@ -32,13 +32,14 @@ proc vm() = while true: {.computedGoto.} let instr = instructions[pc] + let ra = instr.succ # instr.regA case instr of enumA: - echo "yeah A" + echo "yeah A ", ra of enumC, enumD: - echo "yeah CD" + echo "yeah CD ", ra of enumB: - echo "yeah B" + echo "yeah B ", ra of enumE: break inc(pc) diff --git a/tests/compile/tlinearscanend.nim b/tests/casestmt/tlinearscanend.nim index 15fd0c70a..15fd0c70a 100644 --- a/tests/compile/tlinearscanend.nim +++ b/tests/casestmt/tlinearscanend.nim diff --git a/tests/compile/tccgen1.nim b/tests/ccgbugs/tccgen1.nim index 137dd545d..137dd545d 100644 --- a/tests/compile/tccgen1.nim +++ b/tests/ccgbugs/tccgen1.nim diff --git a/tests/run/tcgbug.nim b/tests/ccgbugs/tcgbug.nim index 417b909ae..417b909ae 100644 --- a/tests/run/tcgbug.nim +++ b/tests/ccgbugs/tcgbug.nim diff --git a/tests/compile/tcodegenbug1.nim b/tests/ccgbugs/tcodegenbug1.nim index 7d0fc4ad5..7d0fc4ad5 100644 --- a/tests/compile/tcodegenbug1.nim +++ b/tests/ccgbugs/tcodegenbug1.nim diff --git a/tests/run/tclosure.nim b/tests/closure/tclosure.nim index d9e7b8ee4..d9e7b8ee4 100644 --- a/tests/run/tclosure.nim +++ b/tests/closure/tclosure.nim diff --git a/tests/run/tclosure2.nim b/tests/closure/tclosure2.nim index d2c16eac9..d2c16eac9 100644 --- a/tests/run/tclosure2.nim +++ b/tests/closure/tclosure2.nim diff --git a/tests/run/tclosure3.nim b/tests/closure/tclosure3.nim index bb217387f..bb217387f 100644 --- a/tests/run/tclosure3.nim +++ b/tests/closure/tclosure3.nim diff --git a/tests/compile/tclosure4.nim b/tests/closure/tclosure4.nim index 8e08376b6..8e08376b6 100644 --- a/tests/compile/tclosure4.nim +++ b/tests/closure/tclosure4.nim diff --git a/tests/compile/tclosurebug2.nim b/tests/closure/tclosurebug2.nim index ec4f0045b..ec4f0045b 100644 --- a/tests/compile/tclosurebug2.nim +++ b/tests/closure/tclosurebug2.nim diff --git a/tests/run/tinterf.nim b/tests/closure/tinterf.nim index 726fac9f6..726fac9f6 100644 --- a/tests/run/tinterf.nim +++ b/tests/closure/tinterf.nim diff --git a/tests/reject/tinvalidclosure.nim b/tests/closure/tinvalidclosure.nim index c06270bfa..c06270bfa 100644 --- a/tests/reject/tinvalidclosure.nim +++ b/tests/closure/tinvalidclosure.nim diff --git a/tests/reject/tinvalidclosure2.nim b/tests/closure/tinvalidclosure2.nim index 20e465c12..20e465c12 100644 --- a/tests/reject/tinvalidclosure2.nim +++ b/tests/closure/tinvalidclosure2.nim diff --git a/tests/compile/tnamedparamanonproc.nim b/tests/closure/tnamedparamanonproc.nim index 272b84e91..94e32894f 100644 --- a/tests/compile/tnamedparamanonproc.nim +++ b/tests/closure/tnamedparamanonproc.nim @@ -4,8 +4,8 @@ type TButtonClicked = proc(button: PButton) {.nimcall.} proc newButton*(onClick: TButtonClicked) = - nil - + discard + proc main() = newButton(onClick = proc(b: PButton) = var requestomat = 12 diff --git a/tests/compile/tnestedproc.nim b/tests/closure/tnestedproc.nim index 49ec6f9a7..49ec6f9a7 100644 --- a/tests/compile/tnestedproc.nim +++ b/tests/closure/tnestedproc.nim diff --git a/tests/run/uclosures.nim b/tests/closure/uclosures.nim index 6eea29ca1..6eea29ca1 100644 --- a/tests/run/uclosures.nim +++ b/tests/closure/uclosures.nim diff --git a/tests/run/tcnstseq.nim b/tests/cnstseq/tcnstseq.nim index e7d2333b4..e7d2333b4 100644 --- a/tests/run/tcnstseq.nim +++ b/tests/cnstseq/tcnstseq.nim diff --git a/tests/run/tcnstseq2.nim b/tests/cnstseq/tcnstseq2.nim index 1a27b2ba7..1a27b2ba7 100644 --- a/tests/run/tcnstseq2.nim +++ b/tests/cnstseq/tcnstseq2.nim diff --git a/tests/run/tcnstseq3.nim b/tests/cnstseq/tcnstseq3.nim index e59516e85..e59516e85 100644 --- a/tests/run/tcnstseq3.nim +++ b/tests/cnstseq/tcnstseq3.nim diff --git a/tests/compile/mvarious.nim b/tests/compile/mvarious.nim deleted file mode 100644 index 333b34d33..000000000 --- a/tests/compile/mvarious.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Test a submodule - -#type -# TStringArr = array [0.. *] of string - -proc exportme* = nil diff --git a/tests/compile/sunset.tmpl b/tests/compile/sunset.tmpl deleted file mode 100644 index 6475bac4e..000000000 --- a/tests/compile/sunset.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -#! stdtmpl -#proc sunsetTemplate*(current, ticker, content: string, -# tabs: openarray[array[0..1, string]]): string = -# result = "" -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - -<head> - <title>Nimrod Programming System</title> - <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" type="text/css" href="style/style.css" /> -</head> - -<body> - <div id="main"> - <div id="links"> - <!-- **** INSERT LINKS HERE **** --> - </div> - <div id="logo"><h1>Nimrod Programming System</h1></div> - <div id="content"> - <div id="menu"> - <ul> - #for item in items(tabs): - #var name = item[0] - #var t = item[1] - #if t == current: - <li><a id="selected" href="${t}.html" title = "Nimrod - $name">$name</a></li> - #else: - <li><a href="${t}.html" title = "Nimrod - $name">$name</a></li> - #end if - #end for - </ul> - </div> - <div id="column1"> - <div class="sidebaritem"> - <div class="sbihead"> - <h1>latest news</h1> - </div> - <div class="sbicontent"> - $ticker - </div> - </div> - <div class="sidebaritem"> - <div class="sbihead"> - <h1>additional links</h1> - </div> - <div class="sbilinks"> - <!-- **** INSERT ADDITIONAL LINKS HERE **** --> - <ul> - <li><a class="reference" href="http://llvm.org">LLVM</a></li> - <li><a class="reference" href="http://gcc.gnu.org">GCC</a></li> - </ul> - </div> - </div> - </div> - <div id="column2"> - $content - </div> - </div> - <div id="footer"> - copyright © 2008 Andreas Rumpf | Last update: ${getDateStr()} - | <a class="reference" href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a> - | <a class="reference" href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> - | <a class="reference" href="http://www.dcarter.co.uk">design by dcarter</a> - </div> - </div> -</body> -</html> diff --git a/tests/compile/tambsym2.nim b/tests/compile/tambsym2.nim deleted file mode 100644 index 7758cc31a..000000000 --- a/tests/compile/tambsym2.nim +++ /dev/null @@ -1,6 +0,0 @@ - -from sdl import PSurface - -discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34, - 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32) - diff --git a/tests/compile/tbindtypedesc.nim b/tests/compile/tbindtypedesc.nim deleted file mode 100644 index dd4ef854c..000000000 --- a/tests/compile/tbindtypedesc.nim +++ /dev/null @@ -1,87 +0,0 @@ -discard """ - msg: ''' -int -float -TFoo -TFoo -''' -""" - -import typetraits - -type - TFoo = object - x, y: int - - TBar = tuple - x, y: int - -template good(e: expr) = - static: assert(compiles(e)) - -template bad(e: expr) = - static: assert(not compiles(e)) - -proc genericParamRepeated[T: typedesc](a: T, b: T) = - static: - echo a.name - echo b.name - -good(genericParamRepeated(int, int)) -good(genericParamRepeated(float, float)) - -bad(genericParamRepeated(string, int)) -bad(genericParamRepeated(int, float)) - -proc genericParamOnce[T: typedesc](a, b: T) = - static: - echo a.name - echo b.name - -good(genericParamOnce(int, int)) -good(genericParamOnce(TFoo, TFoo)) - -bad(genericParamOnce(string, int)) -bad(genericParamOnce(TFoo, float)) - -proc typePairs(A, B: type1; C, D: type2) = nil - -good(typePairs(int, int, TFoo, TFOO)) -good(typePairs(TBAR, TBar, TBAR, TBAR)) -good(typePairs(int, int, string, string)) - -bad(typePairs(TBAR, TBar, TBar, TFoo)) -bad(typePairs(string, int, TBAR, TBAR)) - -proc typePairs2[T: typedesc, U: typedesc](A, B: T; C, D: U) = nil - -good(typePairs2(int, int, TFoo, TFOO)) -good(typePairs2(TBAR, TBar, TBAR, TBAR)) -good(typePairs2(int, int, string, string)) - -bad(typePairs2(TBAR, TBar, TBar, TFoo)) -bad(typePairs2(string, int, TBAR, TBAR)) - -proc dontBind(a: typedesc, b: typedesc) = - static: - echo a.name - echo b.name - -good(dontBind(int, float)) -good(dontBind(TFoo, TFoo)) - -proc dontBind2(a, b: typedesc) = nil - -good(dontBind2(int, float)) -good(dontBind2(TBar, int)) - -proc bindArg(T: typedesc, U: typedesc, a, b: T, c, d: U) = nil - -good(bindArg(int, string, 10, 20, "test", "nest")) -good(bindArg(int, int, 10, 20, 30, 40)) - -bad(bindArg(int, string, 10, "test", "test", "nest")) -bad(bindArg(int, int, 10, 20, 30, "test")) -bad(bindArg(int, string, 10.0, 20, "test", "nest")) -bad(bindArg(int, string, "test", "nest", 10, 20)) - diff --git a/tests/compile/tcmdline.nim b/tests/compile/tcmdline.nim deleted file mode 100644 index f4ee20d31..000000000 --- a/tests/compile/tcmdline.nim +++ /dev/null @@ -1,14 +0,0 @@ -# Test the command line - -import - os, strutils - -var - i: int - params = paramCount() -i = 0 -writeln(stdout, "This exe: " & getAppFilename()) -writeln(stdout, "Number of parameters: " & $params) -while i <= params: - writeln(stdout, paramStr(i)) - i = i + 1 diff --git a/tests/compile/tcolonisproc.nim b/tests/compile/tcolonisproc.nim deleted file mode 100644 index e55587dfc..000000000 --- a/tests/compile/tcolonisproc.nim +++ /dev/null @@ -1,12 +0,0 @@ - -proc p(a, b: int, c: proc ()) = - c() - - -p(1, 3): - echo 1 - echo 3 - -p(1, 1, proc() = - echo 1 - echo 2) diff --git a/tests/compile/tdllvar.nim b/tests/compile/tdllvar.nim deleted file mode 100644 index ab767770c..000000000 --- a/tests/compile/tdllvar.nim +++ /dev/null @@ -1,16 +0,0 @@ -import os - -proc getDllName: string = - result = "mylib.dll" - if ExistsFile(result): return - result = "mylib2.dll" - if ExistsFile(result): return - quit("could not load dynamic library") - -proc myImport(s: cstring) {.cdecl, importc, dynlib: getDllName().} -proc myImport2(s: int) {.cdecl, importc, dynlib: getDllName().} - -myImport("test2") -myImport2(12) - - diff --git a/tests/compile/temptyecho.nim b/tests/compile/temptyecho.nim deleted file mode 100644 index 5f1aa6515..000000000 --- a/tests/compile/temptyecho.nim +++ /dev/null @@ -1,2 +0,0 @@ -echo() - diff --git a/tests/compile/tendian.nim b/tests/compile/tendian.nim deleted file mode 100644 index 256e2653c..000000000 --- a/tests/compile/tendian.nim +++ /dev/null @@ -1,3 +0,0 @@ -# test the new endian magic - -writeln(stdout, repr(system.cpuEndian)) diff --git a/tests/compile/tfib.nim b/tests/compile/tfib.nim deleted file mode 100644 index 09a4d5038..000000000 --- a/tests/compile/tfib.nim +++ /dev/null @@ -1,11 +0,0 @@ - -iterator fibonacci(): int = - var a = 0 - var b = 1 - while true: - yield a - var c = b - b = a - a = a + c - - diff --git a/tests/compile/tgenericshardcases.nim b/tests/compile/tgenericshardcases.nim deleted file mode 100644 index 90981c701..000000000 --- a/tests/compile/tgenericshardcases.nim +++ /dev/null @@ -1,30 +0,0 @@ -discard """ - file: "tgenericshardcases.nim" - output: "int\nfloat\nint\nstring" -""" - -import typetraits - -proc typeNameLen(x: typedesc): int {.compileTime.} = - result = x.name.len - -macro selectType(a, b: typedesc): typedesc = - result = a - -type - Foo[T] = object - data1: array[high(T), int] - data2: array[1..typeNameLen(T), selectType(float, string)] - - MyEnum = enum A, B, C,D - -var f1: Foo[MyEnum] -var f2: Foo[int8] - -static: - assert high(f1.data1) == D - assert high(f1.data2) == 6 # length of MyEnum - - assert high(f2.data1) == 127 - assert high(f2.data2) == 4 # length of int8 - diff --git a/tests/compile/tgetstartmilsecs.nim b/tests/compile/tgetstartmilsecs.nim deleted file mode 100644 index 5a3368e0f..000000000 --- a/tests/compile/tgetstartmilsecs.nim +++ /dev/null @@ -1,7 +0,0 @@ -# -import times, os - -var start = epochTime() -os.sleep(1000) - -echo epochTime() - start #OUT 1000 diff --git a/tests/compile/tgtk.nim b/tests/compile/tgtk.nim deleted file mode 100644 index 7febb0ab8..000000000 --- a/tests/compile/tgtk.nim +++ /dev/null @@ -1,51 +0,0 @@ - -import - gtk2, glib2, atk, gdk2, gdk2pixbuf, libglade2, pango, - pangoutils - -proc hello(widget: PWidget, data: pointer) {.cdecl.} = - write(stdout, "Hello World\n") - -proc delete_event(widget: PWidget, event: PEvent, - data: pointer): bool {.cdecl.} = - # If you return FALSE in the "delete_event" signal handler, - # GTK will emit the "destroy" signal. Returning TRUE means - # you don't want the window to be destroyed. - # This is useful for popping up 'are you sure you want to quit?' - # type dialogs. - write(stdout, "delete event occurred\n") - # Change TRUE to FALSE and the main window will be destroyed with - # a "delete_event". - return false - -# Another callback -proc mydestroy(widget: PWidget, data: pointer) {.cdecl.} = - gtk2.main_quit() - -proc mymain() = - # GtkWidget is the storage type for widgets - gtk2.nimrod_init() - var window = window_new(gtk2.WINDOW_TOPLEVEL) - discard g_signal_connect(window, "delete_event", - Gcallback(delete_event), nil) - discard g_signal_connect(window, "destroy", Gcallback(mydestroy), nil) - # Sets the border width of the window. - set_border_width(window, 10) - - # Creates a new button with the label "Hello World". - var button = button_new("Hello World") - - discard g_signal_connect(button, "clicked", Gcallback(hello), nil) - - # This packs the button into the window (a gtk container). - add(window, button) - - # The final step is to display this newly created widget. - show(button) - - # and the window - show(window) - - gtk2.main() - -mymain() diff --git a/tests/compile/thallo.nim b/tests/compile/thallo.nim deleted file mode 100644 index 7244c27a1..000000000 --- a/tests/compile/thallo.nim +++ /dev/null @@ -1,85 +0,0 @@ -# Hallo - -import - os, strutils, macros - -type - TMyEnum = enum - meA, meB, meC, meD - -when isMainModule: - {.hint: "this is the main file".} - -proc fac[T](x: T): T = - # test recursive generic procs - if x <= 1: return 1 - else: return x.`*`(fac(x-1)) - -macro macrotest(n: expr): stmt {.immediate.} = - let n = callsite() - expectKind(n, nnkCall) - expectMinLen(n, 2) - result = newNimNode(nnkStmtList, n) - for i in 2..n.len-1: - result.add(newCall("write", n[1], n[i])) - result.add(newCall("writeln", n[1], newStrLitNode(""))) - -macro debug(n: expr): stmt {.immediate.} = - let n = callsite() - result = newNimNode(nnkStmtList, n) - for i in 1..n.len-1: - result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i]))) - result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": "))) - result.add(newCall("writeln", newIdentNode("stdout"), n[i])) - -macrotest(stdout, "finally", 4, 5, "variable", "argument lists") -macrotest(stdout) - -#GC_disable() - -echo("This was compiled by Nimrod version " & system.nimrodVersion) -writeln(stdout, "Hello", " World", "!") - -echo(["a", "b", "c", "d"].len) -for x in items(["What's", "your", "name", "?", ]): - echo(x) -var `name` = readLine(stdin) -{.breakpoint.} -echo("Hi " & thallo.name & "!\n") -debug(name) - -var testseq: seq[string] = @[ - "a", "b", "c", "d", "e" -] -echo(repr(testseq)) - -var dummy = "hello" -echo(substr(dummy, 2, 3)) - -echo($meC) - -# test tuples: -for x, y in items([(1, 2), (3, 4), (6, 1), (5, 2)]): - echo x - echo y - -proc simpleConst(): int = return 34 - -# test constant evaluation: -const - constEval3 = simpleConst() - constEval = "abc".contains('b') - constEval2 = fac(7) - -echo(constEval3) -echo(constEval) -echo(constEval2) -echo(1.`+`(2)) - -for i in 2..6: - for j in countdown(i+4, 2): - echo(fac(i * j)) - -when isMainModule: - {.hint: "this is the main file".} - diff --git a/tests/compile/theaproots.nim b/tests/compile/theaproots.nim deleted file mode 100644 index aec140f42..000000000 --- a/tests/compile/theaproots.nim +++ /dev/null @@ -1,71 +0,0 @@ -type - Bar = object - x: int - - Foo = object - rheap: ref Bar - rmaybe: ref Bar - rstack: ref Bar - list: seq[ref Bar] - listarr: array[0..5, ref Bar] - nestedtup: Tup - inner: TInner - inref: ref TInner - - TInner = object - inref: ref Bar - - Tup = tuple - tupbar: ref Bar - inner: TInner - -proc acc(x: var Foo): var ref Bar = - result = x.rheap - -proc test(maybeFoo: var Foo, - maybeSeq: var seq[ref Bar], - bars: var openarray[ref Bar], - maybeTup: var Tup) = - var bb: ref Bar - maybeFoo.rmaybe = bb - maybeFoo.list[3] = bb - maybeFoo.listarr[3] = bb - acc(maybeFoo) = bb - - var localFoo: Foo - localFoo.rstack = bb - localFoo.list[3] = bb - localFoo.listarr[3] = bb - acc(localFoo) = bb - - var heapFoo: ref Foo - heapFoo.rheap = bb - heapFoo.list[3] = bb - heapFoo.listarr[3] = bb - acc(heapFoo[]) = bb - - heapFoo.nestedtup.tupbar = bb - heapFoo.nestedtup.inner.inref = bb - heapFoo.inner.inref = bb - heapFoo.inref.inref = bb - - var locseq: seq[ref Bar] - locseq[3] = bb - - var locarr: array[0..4, ref Bar] - locarr[3] = bb - - maybeSeq[3] = bb - - bars[3] = bb - - maybeTup[0] = bb - -var - ff: ref Foo - tt: Tup - gseq: seq[ref Bar] - -new(ff) - -test(ff[], gseq, gseq, tt) diff --git a/tests/compile/tlastmod.nim b/tests/compile/tlastmod.nim deleted file mode 100644 index 75b047fc8..000000000 --- a/tests/compile/tlastmod.nim +++ /dev/null @@ -1,18 +0,0 @@ -# test the new LastModificationTime() proc - -import - os, times, strutils - -proc main() = - var - a, b: TTime - a = getLastModificationTime(ParamStr(1)) - b = getLastModificationTime(ParamStr(2)) - writeln(stdout, $a) - writeln(stdout, $b) - if a < b: - Write(stdout, "$2 is newer than $1\n" % [ParamStr(1), ParamStr(2)]) - else: - Write(stdout, "$1 is newer than $2\n" % [ParamStr(1), ParamStr(2)]) - -main() diff --git a/tests/compile/tlibs.nim b/tests/compile/tlibs.nim deleted file mode 100644 index 971b2b836..000000000 --- a/tests/compile/tlibs.nim +++ /dev/null @@ -1,24 +0,0 @@ -# Test wether the bindings at least compile... - -import - unicode, cgi, terminal, libcurl, - parsexml, parseopt, parsecfg, - osproc, complex, - sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf, - sdl_image, sdl_mixer_nosmpeg, - cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi, - xkblib, xrender, xutil, x, xf86dga, xinerama, xlib, xresource, xv, - gtk2, glib2, pango, gdk2, - cairowin32, cairoxlib, - odbcsql, - gl, glut, glu, glx, glext, wingl, - lua, lualib, lauxlib, mysql, sqlite3, python, tcl, - db_postgres, db_mysql, db_sqlite, ropes, sockets, browsers, httpserver, - httpclient, parseutils, unidecode, xmldom, xmldomparser, xmltree, xmlparser, - htmlparser, re, graphics, colors, pegs, subexes, dialogs - -when defined(linux): - import - zlib, zipfiles - -writeln(stdout, "test compilation of binding modules") diff --git a/tests/compile/tloops.nim b/tests/compile/tloops.nim deleted file mode 100644 index 2b1765b00..000000000 --- a/tests/compile/tloops.nim +++ /dev/null @@ -1,87 +0,0 @@ -# Test nested loops and some other things - -proc andTest() = - var a = 0 == 5 and 6 == 6 - -proc incx(x: var int) = # is built-in proc - x = x + 1 - -proc decx(x: var int) = - x = x - 1 - -proc First(y: var int) = - var x: int - i_ncx(x) - if x == 10: - y = 0 - else: - if x == 0: - incx(x) - else: - x=11 - -proc TestLoops() = - var i, j: int - while i >= 0: - if i mod 3 == 0: - break - i = i + 1 - while j == 13: - j = 13 - break - break - - while True: - break - - -proc Foo(n: int): int = - var - a, old: int - b, c: bool - F_irst(a) - if a == 10: - a = 30 - elif a == 11: - a = 22 - elif a == 12: - a = 23 - elif b: - old = 12 - else: - a = 40 - - # - b = false or 2 == 0 and 3 == 9 - a = 0 + 3 * 5 + 6 + 7 + +8 # 36 - while b: - a = a + 3 - a = a + 5 - write(stdout, "Hello!") - - -# We should come till here :-) -discard Foo(345) - -# test the new type symbol lookup feature: - -type - MyType[T] = tuple[ - x, y, z: T] - MyType2 = tuple[x, y: float] - -proc main[T]() = - var myType: MyType[T] - var b: MyType[T] - b = (1, 2, 3) - myType = b - echo myType - - var myType2: MyType2 - var c: MyType2 - c = (1.0, 2.0) - myType2 = c - echo myType2 - -main[int]() - diff --git a/tests/compile/tmandelbrot.nim b/tests/compile/tmandelbrot.nim deleted file mode 100644 index 1e39c8756..000000000 --- a/tests/compile/tmandelbrot.nim +++ /dev/null @@ -1,57 +0,0 @@ -discard """ - cmd: "nimrod cc --hints:on -d:release $# $#" -""" - -# -*- nimrod -*- - -import math -import os -import strutils - -type TComplex = tuple[re, im: float] - -proc `+` (a, b: TComplex): TComplex = - return (a.re + b.re, a.im + b.im) - -proc `*` (a, b: TComplex): TComplex = - result.re = a.re * b.re - a.im * b.im - result.im = a.re * b.im + a.im * b.re - -proc abs2 (a: TComplex): float = - return a.re * a.re + a.im * a.im - -var size = parseInt (paramStr (1)) -var bit = 128 -var byteAcc = 0 - -stdout.writeln ("P4") -stdout.write ($size) -stdout.write (" ") -stdout.writeln ($size) - -var fsize = float (size) -for y in 0 .. size-1: - var fy = 2.0 * float (y) / fsize - 1.0 - for x in 0 .. size-1: - var z = (0.0, 0.0) - var c = (float (2*x) / fsize - 1.5, fy) - - block iter: - for i in 0 .. 49: - z = z*z + c - if abs2 (z) >= 4.0: - break iter - byteAcc = byteAcc + bit - - if bit > 1: - bit = bit div 2 - else: - stdout.write (chr (byteAcc)) - bit = 128 - byteAcc = 0 - - if bit != 128: - stdout.write (chr (byteAcc)) - bit = 128 - byteAcc = 0 - diff --git a/tests/compile/tnew.nim b/tests/compile/tnew.nim deleted file mode 100644 index 6527541a2..000000000 --- a/tests/compile/tnew.nim +++ /dev/null @@ -1,49 +0,0 @@ -# Test the implementation of the new operator -# and the code generation for gc walkers -# (and the garbage collector): - -type - PNode = ref TNode - TNode = object - data: int - str: string - le, ri: PNode - - TStressTest = ref array [0..45, array [1..45, TNode]] - -proc finalizer(n: PNode) = - write(stdout, n.data) - write(stdout, " is now freed\n") - -proc newNode(data: int, le, ri: PNode): PNode = - new(result, finalizer) - result.le = le - result.ri = ri - result.data = data - -# now loop and build a tree -proc main() = - var - i = 0 - p: TStressTest - while i < 1000: - var n: PNode - - n = newNode(i, nil, newNode(i + 10000, nil, nil)) - inc(i) - new(p) - - write(stdout, "Simple tree node allocation worked!\n") - i = 0 - while i < 1000: - var m = newNode(i + 20000, nil, nil) - var k = newNode(i + 30000, nil, nil) - m.le = m - m.ri = k - k.le = m - k.ri = k - inc(i) - - write(stdout, "Simple cycle allocation worked!\n") - -main() diff --git a/tests/compile/tnewlibs.nim b/tests/compile/tnewlibs.nim deleted file mode 100644 index bdb53ae0b..000000000 --- a/tests/compile/tnewlibs.nim +++ /dev/null @@ -1,17 +0,0 @@ -# Test wether the bindings at least compile... - -import - tcl, - sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf, - sdl_image, sdl_mixer_nosmpeg, - gtk2, glib2, pango, gdk2, - unicode, cgi, terminal, libcurl, - parsexml, parseopt, parsecfg, - osproc, - cairowin32, cairoxlib, - gl, glut, glu, glx, glext, wingl, - lua, lualib, lauxlib, mysql, sqlite3, db_mongo, md5, asyncio, mimetypes, - cookies, events, ftpclient, scgi, irc - - -writeln(stdout, "test compilation of binding modules") diff --git a/tests/compile/tnewsets.nim b/tests/compile/tnewsets.nim deleted file mode 100644 index 415fe8f7e..000000000 --- a/tests/compile/tnewsets.nim +++ /dev/null @@ -1,6 +0,0 @@ -# new test for sets: - -const elem = ' ' - -var s: set[char] = {elem} -assert(elem in s and 'a' not_in s and 'c' not_in s ) diff --git a/tests/compile/tnewuns.nim b/tests/compile/tnewuns.nim deleted file mode 100644 index 5181e467c..000000000 --- a/tests/compile/tnewuns.nim +++ /dev/null @@ -1,12 +0,0 @@ -# test the new unsigned operations: - -import - strutils - -var - x, y: int - -x = 1 -y = high(int) - -writeln(stdout, $ ( x +% y ) ) diff --git a/tests/compile/tnoforward.nim b/tests/compile/tnoforward.nim deleted file mode 100644 index 0359ff348..000000000 --- a/tests/compile/tnoforward.nim +++ /dev/null @@ -1,10 +0,0 @@ -{. noforward: on .} - -proc foo(x: int) = - bar x - -proc bar(x: int) = - echo x - -foo(10) - diff --git a/tests/compile/tparedef.nim b/tests/compile/tparedef.nim deleted file mode 100644 index dedebf6b7..000000000 --- a/tests/compile/tparedef.nim +++ /dev/null @@ -1,4 +0,0 @@ -# This test is now superfluous: - -proc a(a: int) = - return diff --git a/tests/compile/tprep.nim b/tests/compile/tprep.nim deleted file mode 100644 index 4ef9e2543..000000000 --- a/tests/compile/tprep.nim +++ /dev/null @@ -1,30 +0,0 @@ -# Test the features that used to belong to the preprocessor - -import - times - -#{.warning: "This is only a test warning!".} - -const - case2 = true - case3 = true - -when defined(case1): - {.hint: "Case 1".} - when case3: - {.hint: "Case 1.3".} -elif case2: - {.hint: "Case 2".} - when case3: - {.hint: "Case 2.3".} -elif case3: - {.hint: "Case 3".} -else: - {.hint: "unknown case".} - -var - s: string -write(stdout, "compiled at " & system.compileDate & - " " & compileTime & "\n") -echo getDateStr() -echo getClockStr() diff --git a/tests/compile/tquicksort.nim b/tests/compile/tquicksort.nim deleted file mode 100644 index 6706a185e..000000000 --- a/tests/compile/tquicksort.nim +++ /dev/null @@ -1,26 +0,0 @@ -proc QuickSort(list: seq[int]): seq[int] = - if len(list) == 0: - return @[] - var pivot = list[0] - var left: seq[int] = @[] - var right: seq[int] = @[] - for i in low(list)..high(list): - if list[i] < pivot: - left.add(list[i]) - elif list[i] > pivot: - right.add(list[i]) - result = QuickSort(left) & - pivot & - QuickSort(right) - -proc echoSeq(a: seq[int]) = - for i in low(a)..high(a): - echo(a[i]) - -var - list: seq[int] - -list = QuickSort(@[89,23,15,23,56,123,356,12,7,1,6,2,9,4,3]) -echoSeq(list) - - diff --git a/tests/compile/tradix.nim b/tests/compile/tradix.nim deleted file mode 100644 index e5998ee12..000000000 --- a/tests/compile/tradix.nim +++ /dev/null @@ -1,319 +0,0 @@ -# implements and tests an efficient radix tree - -## another method to store an efficient array of pointers: -## We use a radix tree with node compression. -## There are two node kinds: - -const bitsPerUnit = 8*sizeof(int) - -type - TRadixNodeKind = enum rnLinear, rnFull, rnLeafBits, rnLeafLinear - PRadixNode = ptr TRadixNode - TRadixNode {.pure, inheritable.} = object - kind: TRadixNodeKind - TRadixNodeLinear = object of TRadixNode - len: int8 - keys: array [0..31, int8] - vals: array [0..31, PRadixNode] - - TRadixNodeFull = object of TRadixNode - b: array [0..255, PRadixNode] - TRadixNodeLeafBits = object of TRadixNode - b: array [0..7, int] - TRadixNodeLeafLinear = object of TRadixNode - len: int8 - keys: array [0..31, int8] - -var - root: PRadixNode - -proc searchInner(r: PRadixNode, a: int): PRadixNode = - case r.kind - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(x.len)-1: - if ze(x.keys[i]) == a: return x.vals[i] - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - return x.b[a] - else: assert(false) - -proc testBit(w, i: int): bool {.inline.} = - result = (w and (1 shl (i %% BitsPerUnit))) != 0 - -proc setBit(w: var int, i: int) {.inline.} = - w = w or (1 shl (i %% bitsPerUnit)) - -proc resetBit(w: var int, i: int) {.inline.} = - w = w and not (1 shl (i %% bitsPerUnit)) - -proc testOrSetBit(w: var int, i: int): bool {.inline.} = - var x = (1 shl (i %% bitsPerUnit)) - if (w and x) != 0: return true - w = w or x - -proc searchLeaf(r: PRadixNode, a: int): bool = - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - return testBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(x.len)-1: - if ze(x.keys[i]) == a: return true - else: assert(false) - -proc exclLeaf(r: PRadixNode, a: int) = - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - resetBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == a: - x.keys[i] = x.keys[L-1] - dec(x.len) - return - else: assert(false) - -proc contains*(r: PRadixNode, a: TAddress): bool = - if r == nil: return false - var x = searchInner(r, a shr 24 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 16 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 8 and 0xff) - if x == nil: return false - return searchLeaf(x, a and 0xff) - -proc excl*(r: PRadixNode, a: TAddress): bool = - if r == nil: return false - var x = searchInner(r, a shr 24 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 16 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 8 and 0xff) - if x == nil: return false - exclLeaf(x, a and 0xff) - -proc addLeaf(r: var PRadixNode, a: int): bool = - if r == nil: - # a linear node: - var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) - x.kind = rnLeafLinear - x.len = 1'i8 - x.keys[0] = toU8(a) - r = x - return false # not already in set - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - return testOrSetBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == a: return true - if L <= high(x.keys): - x.keys[L] = toU8(a) - inc(x.len) - else: - # transform into a full node: - var y = cast[ptr TRadixNodeLeafBits](alloc0(sizeof(TRadixNodeLeafBits))) - y.kind = rnLeafBits - for i in 0..ze(x.len)-1: - var u = ze(x.keys[i]) - setBit(y.b[u /% BitsPerUnit], u) - setBit(y.b[a /% BitsPerUnit], a) - dealloc(r) - r = y - else: assert(false) - -proc addInner(r: var PRadixNode, a: int, d: int): bool = - if d == 0: - return addLeaf(r, a and 0xff) - var k = a shr d and 0xff - if r == nil: - # a linear node: - var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) - x.kind = rnLinear - x.len = 1'i8 - x.keys[0] = toU8(k) - r = x - return addInner(x.vals[0], a, d-8) - case r.kind - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == k: # already exists - return addInner(x.vals[i], a, d-8) - if L <= high(x.keys): - x.keys[L] = toU8(k) - inc(x.len) - return addInner(x.vals[L], a, d-8) - else: - # transform into a full node: - var y = cast[ptr TRadixNodeFull](alloc0(sizeof(TRadixNodeFull))) - y.kind = rnFull - for i in 0..L-1: y.b[ze(x.keys[i])] = x.vals[i] - dealloc(r) - r = y - return addInner(y.b[k], a, d-8) - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - return addInner(x.b[k], a, d-8) - else: assert(false) - -proc incl*(r: var PRadixNode, a: TAddress) {.inline.} = - discard addInner(r, a, 24) - -proc testOrIncl*(r: var PRadixNode, a: TAddress): bool {.inline.} = - return addInner(r, a, 24) - -iterator innerElements(r: PRadixNode): tuple[prefix: int, n: PRadixNode] = - if r != nil: - case r.kind - of rnFull: - var r = cast[ptr TRadixNodeFull](r) - for i in 0..high(r.b): - if r.b[i] != nil: - yield (i, r.b[i]) - of rnLinear: - var r = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(r.len)-1: - yield (ze(r.keys[i]), r.vals[i]) - else: assert(false) - -iterator leafElements(r: PRadixNode): int = - if r != nil: - case r.kind - of rnLeafBits: - var r = cast[ptr TRadixNodeLeafBits](r) - # iterate over any bit: - for i in 0..high(r.b): - if r.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(r.b[i], j): - yield i*BitsPerUnit+j - of rnLeafLinear: - var r = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(r.len)-1: - yield ze(r.keys[i]) - else: assert(false) - -iterator elements*(r: PRadixNode): TAddress {.inline.} = - for p1, n1 in innerElements(r): - for p2, n2 in innerElements(n1): - for p3, n3 in innerElements(n2): - for p4 in leafElements(n3): - yield p1 shl 24 or p2 shl 16 or p3 shl 8 or p4 - -proc main() = - const - numbers = [128, 1, 2, 3, 4, 255, 17, -8, 45, 19_000] - var - r: PRadixNode = nil - for x in items(numbers): - echo testOrIncl(r, x) - for x in elements(r): echo(x) - -main() - - -when false: - proc traverse(r: PRadixNode, prefix: int, d: int) = - if r == nil: return - case r.kind - of rnLeafBits: - assert(d == 0) - var x = cast[ptr TRadixNodeLeafBits](r) - # iterate over any bit: - for i in 0..high(x.b): - if x.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(x.b[i], j): - visit(prefix or i*BitsPerUnit+j) - of rnLeafLinear: - assert(d == 0) - var x = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(x.len)-1: - visit(prefix or ze(x.keys[i])) - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - for i in 0..high(r.b): - if r.b[i] != nil: - traverse(r.b[i], prefix or (i shl d), d-8) - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(x.len)-1: - traverse(x.vals[i], prefix or (ze(x.keys[i]) shl d), d-8) - - type - TRadixIter {.final.} = object - r: PRadixNode - p: int - x: int - - proc init(i: var TRadixIter, r: PRadixNode) = - i.r = r - i.x = 0 - i.p = 0 - - proc nextr(i: var TRadixIter): PRadixNode = - if i.r == nil: return nil - case i.r.kind - of rnFull: - var r = cast[ptr TRadixNodeFull](i.r) - while i.x <= high(r.b): - if r.b[i.x] != nil: - i.p = i.x - return r.b[i.x] - inc(i.x) - of rnLinear: - var r = cast[ptr TRadixNodeLinear](i.r) - if i.x < ze(r.len): - i.p = ze(r.keys[i.x]) - result = r.vals[i.x] - inc(i.x) - else: assert(false) - - proc nexti(i: var TRadixIter): int = - result = -1 - case i.r.kind - of rnLeafBits: - var r = cast[ptr TRadixNodeLeafBits](i.r) - # iterate over any bit: - for i in 0..high(r.b): - if x.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(x.b[i], j): - visit(prefix or i*BitsPerUnit+j) - of rnLeafLinear: - var r = cast[ptr TRadixNodeLeafLinear](i.r) - if i.x < ze(r.len): - result = ze(r.keys[i.x]) - inc(i.x) - - iterator elements(r: PRadixNode): TAddress {.inline.} = - var - a, b, c, d: TRadixIter - init(a, r) - while true: - var x = nextr(a) - if x != nil: - init(b, x) - while true: - var y = nextr(b) - if y != nil: - init(c, y) - while true: - var z = nextr(c) - if z != nil: - init(d, z) - while true: - var q = nexti(d) - if q != -1: - yield a.p shl 24 or b.p shl 16 or c.p shl 8 or q diff --git a/tests/compile/treadln.nim b/tests/compile/treadln.nim deleted file mode 100644 index 1117ab5f9..000000000 --- a/tests/compile/treadln.nim +++ /dev/null @@ -1,12 +0,0 @@ -# test the improved readline handling that does not care whether its -# Macintosh, Unix or Windows text format. - -var - inp: TFile - line: string - -if open(inp, "readme.txt"): - while not EndOfFile(inp): - line = readLine(inp) - echo("#" & line & "#") - close(inp) diff --git a/tests/compile/treadx.nim b/tests/compile/treadx.nim deleted file mode 100644 index 49b6ad691..000000000 --- a/tests/compile/treadx.nim +++ /dev/null @@ -1,14 +0,0 @@ - -when not defined(windows): - import posix - - var inp = "" - var buf: array[0..10, char] - while true: - var r = read(0, addr(buf), sizeof(buf)-1) - add inp, $buf - if r != sizeof(buf)-1: break - - echo inp - #dafkladskölklödsaf ölksdakölfölksfklwe4iojr389wr 89uweokf sdlkf jweklr jweflksdj fioewjfsdlfsd - diff --git a/tests/compile/tshadow_magic_type.nim b/tests/compile/tshadow_magic_type.nim deleted file mode 100644 index 5cd27435e..000000000 --- a/tests/compile/tshadow_magic_type.nim +++ /dev/null @@ -1,24 +0,0 @@ -type - TListItemType* = enum - RedisNil, RedisString - - TListItem* = object - case kind*: TListItemType - of RedisString: - str*: string - else: nil - TRedisList* = seq[TListItem] - -# Caused by this. -proc seq*() = - nil - -proc lrange*(key: string): TRedisList = - var foo: TListItem - foo.kind = RedisNil - result = @[foo] - -when isMainModule: - var p = lrange("mylist") - for i in items(p): - echo(i.str) diff --git a/tests/compile/tsizeof.nim b/tests/compile/tsizeof.nim deleted file mode 100644 index f7b70dd4d..000000000 --- a/tests/compile/tsizeof.nim +++ /dev/null @@ -1,10 +0,0 @@ -# Test the sizeof proc - -type - TMyRecord {.final.} = object - x, y: int - b: bool - r: float - s: string - -write(stdout, sizeof(TMyRecord)) diff --git a/tests/compile/tstrace.nim b/tests/compile/tstrace.nim deleted file mode 100644 index 3032a34a3..000000000 --- a/tests/compile/tstrace.nim +++ /dev/null @@ -1,16 +0,0 @@ -# Test the new stacktraces (great for debugging!) - -{.push stack_trace: on.} - -proc recTest(i: int) = - # enter - if i < 10: - recTest(i+1) - else: # should printStackTrace() - var p: ptr int = nil - p[] = 12 - # leave - -{.pop.} - -recTest(0) diff --git a/tests/compile/tstrdesc.nim b/tests/compile/tstrdesc.nim deleted file mode 100644 index 1c2e85b4b..000000000 --- a/tests/compile/tstrdesc.nim +++ /dev/null @@ -1,14 +0,0 @@ -var - x: array [0..2, int] - -x = [0, 1, 2] - -type - TStringDesc {.final.} = object - len, space: int # len and space without counting the terminating zero - data: array [0..0, char] # for the '\0' character - -var - emptyString {.exportc: "emptyString".}: TStringDesc - - diff --git a/tests/compile/tstrdist.nim b/tests/compile/tstrdist.nim deleted file mode 100644 index 3e1939e73..000000000 --- a/tests/compile/tstrdist.nim +++ /dev/null @@ -1,26 +0,0 @@ -# compute the edit distance between two strings - -proc editDistance(a, b: string): int = - var - c: seq[int] - n = a.len - m = b.len - newSeq(c, (n+1)*(m+1)) - for i in 0..n: - c[i*n] = i # [i,0] - for j in 0..m: - c[j] = j # [0,j] - - for i in 1..n: - for j in 1..m: - var x = c[(i-1)*n + j]+1 - var y = c[i*n + j-1]+1 - var z: int - if a[i-1] == b[j-1]: - z = c[(i-1)*n + j-1] - else: - z = c[(i-1)*n + j-1]+1 - c[(i-1)*n + (j-1)] = min(x,min(y,z)) - return c[n*m] - -write(stdout, editDistance("abc", "abd")) diff --git a/tests/compile/tvarious.nim b/tests/compile/tvarious.nim deleted file mode 100644 index 5883ba62f..000000000 --- a/tests/compile/tvarious.nim +++ /dev/null @@ -1,63 +0,0 @@ -# Test various aspects - -# bug #572 -var a=12345678901'u64 - -var x = (x: 42, y: (a: 8, z: 10)) -echo x.y - -import - mvarious - -type - PA = ref TA - PB = ref TB - - TB = object - a: PA - - TA = object - b: TB - x: int - -proc getPA(): PA = - var - b: bool - b = not false - return nil - -# bug #501 -proc f(): int = 54 - -var - global: int - -var - s: string - i: int - r: TA - -r.b.a.x = 0 -global = global + 1 -exportme() -write(stdout, "Hallo wie heißt du? ") -write(stdout, getPA().x) -s = readLine(stdin) -i = 0 -while i < s.len: - if s[i] == 'c': write(stdout, "'c' in deinem Namen gefunden\n") - i = i + 1 - -write(stdout, "Du heißt " & s) - -# bug #544 - -type Bar [T; I:range] = array[I, T] -proc foo*[T; I:range](a, b: Bar[T, I]): Bar[T, I] = - when len(a) != 3: - # Error: constant expression expected - {.fatal:"Dimensions have to be 3".} - #... -block: - var a, b: Bar[int, 0..2] - discard foo(a, b) diff --git a/tests/compile/tcompiles.nim b/tests/compiles/tcompiles.nim index d0fccdaff..d0fccdaff 100644 --- a/tests/compile/tcompiles.nim +++ b/tests/compiles/tcompiles.nim diff --git a/tests/run/tconcat.nim b/tests/concat/tconcat.nim index fdce3ea00..fdce3ea00 100644 --- a/tests/run/tconcat.nim +++ b/tests/concat/tconcat.nim diff --git a/tests/run/tnodeadlocks.nim b/tests/concurrency/tnodeadlocks.nim index 18fdca3e9..18fdca3e9 100644 --- a/tests/run/tnodeadlocks.nim +++ b/tests/concurrency/tnodeadlocks.nim diff --git a/tests/reject/tconstr1.nim b/tests/constr/tconstr1.nim index cb6594213..cb6594213 100644 --- a/tests/reject/tconstr1.nim +++ b/tests/constr/tconstr1.nim diff --git a/tests/run/tconstr2.nim b/tests/constr/tconstr2.nim index 30cec5cb8..30cec5cb8 100644 --- a/tests/run/tconstr2.nim +++ b/tests/constr/tconstr2.nim diff --git a/tests/reject/tconstraints.nim b/tests/constraints/tconstraints.nim index e61095fff..e61095fff 100644 --- a/tests/reject/tconstraints.nim +++ b/tests/constraints/tconstraints.nim diff --git a/tests/reject/tblock1.nim b/tests/controlflow/tblock1.nim index 5c41aaf82..5c41aaf82 100644 --- a/tests/reject/tblock1.nim +++ b/tests/controlflow/tblock1.nim diff --git a/tests/run/tcontinue.nim b/tests/controlflow/tcontinue.nim index 092026e8c..092026e8c 100644 --- a/tests/run/tcontinue.nim +++ b/tests/controlflow/tcontinue.nim diff --git a/tests/run/tnestif.nim b/tests/controlflow/tnestif.nim index bfcd8751c..bfcd8751c 100644 --- a/tests/run/tnestif.nim +++ b/tests/controlflow/tnestif.nim diff --git a/tests/reject/tstatret.nim b/tests/controlflow/tstatret.nim index bf90255a0..bf90255a0 100644 --- a/tests/reject/tstatret.nim +++ b/tests/controlflow/tstatret.nim diff --git a/tests/compile/tconvcolors.nim b/tests/converter/tconvcolors.nim index 07e829550..07e829550 100644 --- a/tests/compile/tconvcolors.nim +++ b/tests/converter/tconvcolors.nim diff --git a/tests/compile/tconvert.nim b/tests/converter/tconvert.nim index a8ddcf119..a8ddcf119 100644 --- a/tests/compile/tconvert.nim +++ b/tests/converter/tconvert.nim diff --git a/tests/run/tgenericconverter.nim b/tests/converter/tgenericconverter.nim index e1c9f7c4c..e1c9f7c4c 100644 --- a/tests/run/tgenericconverter.nim +++ b/tests/converter/tgenericconverter.nim diff --git a/tests/compile/ttypeconverter1.nim b/tests/converter/ttypeconverter1.nim index b9a5e88ae..b9a5e88ae 100644 --- a/tests/compile/ttypeconverter1.nim +++ b/tests/converter/ttypeconverter1.nim diff --git a/tests/compile/mdefaultprocparam.nim b/tests/defaultprocparam/mdefaultprocparam.nim index 4a17277c0..4a17277c0 100644 --- a/tests/compile/mdefaultprocparam.nim +++ b/tests/defaultprocparam/mdefaultprocparam.nim diff --git a/tests/compile/tdefaultprocparam.nim b/tests/defaultprocparam/tdefaultprocparam.nim index 23ecf72e9..23ecf72e9 100644 --- a/tests/compile/tdefaultprocparam.nim +++ b/tests/defaultprocparam/tdefaultprocparam.nim diff --git a/tests/reject/tdeprecated.nim b/tests/deprecated/tdeprecated.nim index f41f0a72f..f41f0a72f 100644 --- a/tests/reject/tdeprecated.nim +++ b/tests/deprecated/tdeprecated.nim diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim new file mode 100644 index 000000000..bb1410d92 --- /dev/null +++ b/tests/destructor/tdestructor.nim @@ -0,0 +1,84 @@ +discard """ + output: '''---- +myobj constructed +myobj destroyed +---- +mygeneric1 constructed +mygeneric1 destroyed +---- +mygeneric2 constructed +mygeneric2 destroyed +myobj destroyed +---- +mygeneric3 constructed +mygeneric1 destroyed +''' +""" + +type + TMyObj = object + x, y: int + p: pointer + + TMyGeneric1[T] = object + x: T + + TMyGeneric2[A, B] = object + x: A + y: B + + TMyGeneric3[A, B, C] = object + x: A + y: B + z: C + +proc destruct(o: var TMyObj) {.destructor.} = + if o.p != nil: dealloc o.p + echo "myobj destroyed" + +proc destroy(o: var TMyGeneric1) {.destructor.} = + echo "mygeneric1 destroyed" + +proc destroy[A, B](o: var TMyGeneric2[A, B]) {.destructor.} = + echo "mygeneric2 destroyed" + +proc open: TMyObj = + # allow for superfluous () + result = (TMyObj(x: 1, y: 2, p: alloc(3))) + +proc `$`(x: TMyObj): string = $x.y + +proc myobj() = + var x = open() + echo "myobj constructed" + +proc mygeneric1() = + var x = TMyGeneric1[int](x: 10) + echo "mygeneric1 constructed" + +proc mygeneric2[T](val: T) = + var + a = open() + b = TMyGeneric2[int, T](x: 10, y: val) + c = TMyGeneric3[int, int, string](x: 10, y: 20, z: "test") + + echo "mygeneric2 constructed" + +proc mygeneric3 = + var x = TMyGeneric3[int, string, TMyGeneric1[int]]( + x: 10, y: "test", z: TMyGeneric1[int](x: 10)) + + echo "mygeneric3 constructed" + +echo "----" +myobj() + +echo "----" +mygeneric1() + +echo "----" +mygeneric2[int](10) + +echo "----" +mygeneric3() + diff --git a/tests/reject/tdestructor.nim b/tests/destructor/tdestructor2.nim index da9192a3f..da9192a3f 100644 --- a/tests/reject/tdestructor.nim +++ b/tests/destructor/tdestructor2.nim diff --git a/tests/compile/tdictdestruct.nim b/tests/destructor/tdictdestruct.nim index ec1084105..ec1084105 100644 --- a/tests/compile/tdictdestruct.nim +++ b/tests/destructor/tdictdestruct.nim diff --git a/tests/compile/tdiscardable.nim b/tests/discard/tdiscardable.nim index c0551ba2f..c0551ba2f 100644 --- a/tests/compile/tdiscardable.nim +++ b/tests/discard/tdiscardable.nim diff --git a/tests/reject/tneedsdiscard.nim b/tests/discard/tneedsdiscard.nim index 24f5b2eee..24f5b2eee 100644 --- a/tests/reject/tneedsdiscard.nim +++ b/tests/discard/tneedsdiscard.nim diff --git a/tests/run/tcurrncy.nim b/tests/distinct/tcurrncy.nim index 78dbc2a89..78dbc2a89 100644 --- a/tests/run/tcurrncy.nim +++ b/tests/distinct/tcurrncy.nim diff --git a/tests/reject/teffects1.nim b/tests/effects/teffects1.nim index 1c6c4bed8..b72e8b00c 100644 --- a/tests/reject/teffects1.nim +++ b/tests/effects/teffects1.nim @@ -1,5 +1,5 @@ discard """ - line: 1804 + line: 1855 file: "system.nim" errormsg: "can raise an unlisted exception: ref EIO" """ diff --git a/tests/reject/teffects2.nim b/tests/effects/teffects2.nim index 7e6b17c36..7e6b17c36 100644 --- a/tests/reject/teffects2.nim +++ b/tests/effects/teffects2.nim diff --git a/tests/reject/teffects3.nim b/tests/effects/teffects3.nim index 78543a929..78543a929 100644 --- a/tests/reject/teffects3.nim +++ b/tests/effects/teffects3.nim diff --git a/tests/reject/teffects4.nim b/tests/effects/teffects4.nim index 4584e6dc8..4584e6dc8 100644 --- a/tests/reject/teffects4.nim +++ b/tests/effects/teffects4.nim diff --git a/tests/reject/teffects5.nim b/tests/effects/teffects5.nim index d630a6fc4..d630a6fc4 100644 --- a/tests/reject/teffects5.nim +++ b/tests/effects/teffects5.nim diff --git a/tests/compile/teffects1.nim b/tests/effects/teffects6.nim index 54200f2c3..54200f2c3 100644 --- a/tests/compile/teffects1.nim +++ b/tests/effects/teffects6.nim diff --git a/tests/reject/tsidee1.nim b/tests/effects/tsidee1.nim index bd5b32dd7..bd5b32dd7 100644 --- a/tests/reject/tsidee1.nim +++ b/tests/effects/tsidee1.nim diff --git a/tests/run/tsidee2.nim b/tests/effects/tsidee2.nim index e73c89608..e73c89608 100644 --- a/tests/run/tsidee2.nim +++ b/tests/effects/tsidee2.nim diff --git a/tests/run/tsidee3.nim b/tests/effects/tsidee3.nim index e0c427ab6..e0c427ab6 100644 --- a/tests/run/tsidee3.nim +++ b/tests/effects/tsidee3.nim diff --git a/tests/reject/tsidee4.nim b/tests/effects/tsidee4.nim index cbebfbd36..cbebfbd36 100644 --- a/tests/reject/tsidee4.nim +++ b/tests/effects/tsidee4.nim diff --git a/tests/compile/tenum.nim b/tests/enum/tenum.nim index 6e53b9c08..6e53b9c08 100644 --- a/tests/compile/tenum.nim +++ b/tests/enum/tenum.nim diff --git a/tests/compile/tenum2.nim b/tests/enum/tenum2.nim index feba36dd6..feba36dd6 100644 --- a/tests/compile/tenum2.nim +++ b/tests/enum/tenum2.nim diff --git a/tests/compile/tenum3.nim b/tests/enum/tenum3.nim index 09a516932..09a516932 100644 --- a/tests/compile/tenum3.nim +++ b/tests/enum/tenum3.nim diff --git a/tests/run/tenumhole.nim b/tests/enum/tenumhole.nim index a35526378..a35526378 100644 --- a/tests/run/tenumhole.nim +++ b/tests/enum/tenumhole.nim diff --git a/tests/reject/tenumitems.nim b/tests/enum/tenumitems.nim index b6eee5ba8..b6eee5ba8 100644 --- a/tests/reject/tenumitems.nim +++ b/tests/enum/tenumitems.nim diff --git a/tests/run/tenumitems.nim b/tests/enum/tenumitems2.nim index db4c6b554..db4c6b554 100644 --- a/tests/run/tenumitems.nim +++ b/tests/enum/tenumitems2.nim diff --git a/tests/reject/tenummix.nim b/tests/enum/tenummix.nim index f58e7989d..aaf0be2cb 100644 --- a/tests/reject/tenummix.nim +++ b/tests/enum/tenummix.nim @@ -1,6 +1,6 @@ discard """ - file: "system.nim" - line: 696 + file: "tenummix.nim" + line: 11 errormsg: "type mismatch" """ diff --git a/tests/run/tnamedenumfields.nim b/tests/enum/tnamedenumfields.nim index e9ac88a42..e9ac88a42 100644 --- a/tests/run/tnamedenumfields.nim +++ b/tests/enum/tnamedenumfields.nim diff --git a/tests/compile/toptions.nim b/tests/enum/toptions.nim index 95bb5cfbc..3c841de2c 100644 --- a/tests/compile/toptions.nim +++ b/tests/enum/toptions.nim @@ -1,7 +1,3 @@ -# Converted by Pas2mor v1.54 -# Used command line arguments: -# -m -q -o bootstrap\options.mor options.pas -# type # please make sure we have under 32 options (improves code efficiency!) diff --git a/tests/run/tcontinuexc.nim b/tests/exception/tcontinuexc.nim index f618abc14..f618abc14 100644 --- a/tests/run/tcontinuexc.nim +++ b/tests/exception/tcontinuexc.nim diff --git a/tests/run/texceptions.nim b/tests/exception/texceptions.nim index 69b2d0f6a..69b2d0f6a 100644 --- a/tests/run/texceptions.nim +++ b/tests/exception/texceptions.nim diff --git a/tests/run/texcpt1.nim b/tests/exception/texcpt1.nim index ec74c9470..ec74c9470 100644 --- a/tests/run/texcpt1.nim +++ b/tests/exception/texcpt1.nim diff --git a/tests/run/texcsub.nim b/tests/exception/texcsub.nim index 3dba357f9..3dba357f9 100644 --- a/tests/run/texcsub.nim +++ b/tests/exception/texcsub.nim diff --git a/tests/run/tfinally.nim b/tests/exception/tfinally.nim index 16fb3e7da..16fb3e7da 100644 --- a/tests/run/tfinally.nim +++ b/tests/exception/tfinally.nim diff --git a/tests/run/tfinally2.nim b/tests/exception/tfinally2.nim index e1e8d4c7e..e1e8d4c7e 100644 --- a/tests/run/tfinally2.nim +++ b/tests/exception/tfinally2.nim diff --git a/tests/run/tfinally3.nim b/tests/exception/tfinally3.nim index e65661cd0..e65661cd0 100644 --- a/tests/run/tfinally3.nim +++ b/tests/exception/tfinally3.nim diff --git a/tests/run/tonraise.nim b/tests/exception/tonraise.nim index 1a555dd94..1a555dd94 100644 --- a/tests/run/tonraise.nim +++ b/tests/exception/tonraise.nim diff --git a/tests/run/treraise.nim b/tests/exception/treraise.nim index cbd0b5f8a..cbd0b5f8a 100644 --- a/tests/run/treraise.nim +++ b/tests/exception/treraise.nim diff --git a/tests/run/tunhandledexc.nim b/tests/exception/tunhandledexc.nim index f24881aef..f24881aef 100644 --- a/tests/run/tunhandledexc.nim +++ b/tests/exception/tunhandledexc.nim diff --git a/tests/run/twrongexc.nim b/tests/exception/twrongexc.nim index 755f7d979..755f7d979 100644 --- a/tests/run/twrongexc.nim +++ b/tests/exception/twrongexc.nim diff --git a/tests/reject/texprstmt.nim b/tests/exprs/texprstmt.nim index b32394d8d..b32394d8d 100644 --- a/tests/reject/texprstmt.nim +++ b/tests/exprs/texprstmt.nim diff --git a/tests/reject/tstmtexp.nim b/tests/exprs/tstmtexp.nim index 7cbf2eb3d..7cbf2eb3d 100644 --- a/tests/reject/tstmtexp.nim +++ b/tests/exprs/tstmtexp.nim diff --git a/tests/run/tstmtexprs.nim b/tests/exprs/tstmtexprs.nim index 497a2f6d0..497a2f6d0 100644 --- a/tests/run/tstmtexprs.nim +++ b/tests/exprs/tstmtexprs.nim diff --git a/tests/run/tfieldindex.nim b/tests/fields/tfieldindex.nim index f0674af54..f0674af54 100644 --- a/tests/run/tfieldindex.nim +++ b/tests/fields/tfieldindex.nim diff --git a/tests/run/tfielditerator.nim b/tests/fields/tfielditerator.nim index 2919aab41..2919aab41 100644 --- a/tests/run/tfielditerator.nim +++ b/tests/fields/tfielditerator.nim diff --git a/tests/run/tfielditerator2.nim b/tests/fields/tfielditerator2.nim index 76fa568f2..76fa568f2 100644 --- a/tests/run/tfielditerator2.nim +++ b/tests/fields/tfielditerator2.nim diff --git a/tests/run/tfloat1.nim b/tests/float/tfloat1.nim index f290fdb57..f290fdb57 100644 --- a/tests/run/tfloat1.nim +++ b/tests/float/tfloat1.nim diff --git a/tests/run/tfloat2.nim b/tests/float/tfloat2.nim index 51883674f..51883674f 100644 --- a/tests/run/tfloat2.nim +++ b/tests/float/tfloat2.nim diff --git a/tests/run/tfloat3.nim b/tests/float/tfloat3.nim index 4382dd3ed..4382dd3ed 100644 --- a/tests/run/tfloat3.nim +++ b/tests/float/tfloat3.nim diff --git a/tests/run/mfriends.nim b/tests/friends/mfriends.nim index f1c663655..f1c663655 100644 --- a/tests/run/mfriends.nim +++ b/tests/friends/mfriends.nim diff --git a/tests/run/tfriends.nim b/tests/friends/tfriends.nim index 1e70d50a5..1e70d50a5 100644 --- a/tests/run/tfriends.nim +++ b/tests/friends/tfriends.nim diff --git a/tests/run/tbintre2.nim b/tests/generics/tbintre2.nim index 2a7225411..2a7225411 100644 --- a/tests/run/tbintre2.nim +++ b/tests/generics/tbintre2.nim diff --git a/tests/run/tbintree.nim b/tests/generics/tbintree.nim index 8cc8acb82..8cc8acb82 100644 --- a/tests/run/tbintree.nim +++ b/tests/generics/tbintree.nim diff --git a/tests/compile/tcan_alias_generic.nim b/tests/generics/tcan_alias_generic.nim index e90bdc6d2..e90bdc6d2 100644 --- a/tests/compile/tcan_alias_generic.nim +++ b/tests/generics/tcan_alias_generic.nim diff --git a/tests/compile/tcan_alias_specialised_generic.nim b/tests/generics/tcan_alias_specialised_generic.nim index 8d4a29abd..8d4a29abd 100644 --- a/tests/compile/tcan_alias_specialised_generic.nim +++ b/tests/generics/tcan_alias_specialised_generic.nim diff --git a/tests/compile/tcan_inherit_generic.nim b/tests/generics/tcan_inherit_generic.nim index a6f4d946b..a6f4d946b 100644 --- a/tests/compile/tcan_inherit_generic.nim +++ b/tests/generics/tcan_inherit_generic.nim diff --git a/tests/compile/tcan_specialise_generic.nim b/tests/generics/tcan_specialise_generic.nim index 64d5f56e3..64d5f56e3 100644 --- a/tests/compile/tcan_specialise_generic.nim +++ b/tests/generics/tcan_specialise_generic.nim diff --git a/tests/run/texplicitgeneric1.nim b/tests/generics/texplicitgeneric1.nim index 6cca71ac0..6cca71ac0 100644 --- a/tests/run/texplicitgeneric1.nim +++ b/tests/generics/texplicitgeneric1.nim diff --git a/tests/run/texplicitgeneric2.nim b/tests/generics/texplicitgeneric2.nim index 95461d023..95461d023 100644 --- a/tests/run/texplicitgeneric2.nim +++ b/tests/generics/texplicitgeneric2.nim diff --git a/tests/compile/tforwardgeneric.nim b/tests/generics/tforwardgeneric.nim index c5943b966..c5943b966 100644 --- a/tests/compile/tforwardgeneric.nim +++ b/tests/generics/tforwardgeneric.nim diff --git a/tests/compile/tgeneric.nim b/tests/generics/tgeneric0.nim index 9292b729f..9292b729f 100644 --- a/tests/compile/tgeneric.nim +++ b/tests/generics/tgeneric0.nim diff --git a/tests/run/tgenerics1.nim b/tests/generics/tgeneric1.nim index 5d20a864b..5d20a864b 100644 --- a/tests/run/tgenerics1.nim +++ b/tests/generics/tgeneric1.nim diff --git a/tests/compile/tgeneric2.nim b/tests/generics/tgeneric2.nim index 56803017a..56803017a 100644 --- a/tests/compile/tgeneric2.nim +++ b/tests/generics/tgeneric2.nim diff --git a/tests/compile/tgeneric3.nim b/tests/generics/tgeneric3.nim index 3c543ecfa..3c543ecfa 100644 --- a/tests/compile/tgeneric3.nim +++ b/tests/generics/tgeneric3.nim diff --git a/tests/compile/tgeneric4.nim b/tests/generics/tgeneric4.nim index f79096636..f79096636 100644 --- a/tests/compile/tgeneric4.nim +++ b/tests/generics/tgeneric4.nim diff --git a/tests/compile/tgenericdefaults.nim b/tests/generics/tgenericdefaults.nim index ad96f1851..ad96f1851 100644 --- a/tests/compile/tgenericdefaults.nim +++ b/tests/generics/tgenericdefaults.nim diff --git a/tests/compile/tgenericmatcher.nim b/tests/generics/tgenericmatcher.nim index edd0c4cf1..edd0c4cf1 100644 --- a/tests/compile/tgenericmatcher.nim +++ b/tests/generics/tgenericmatcher.nim diff --git a/tests/compile/tgenericmatcher2.nim b/tests/generics/tgenericmatcher2.nim index aa2f9dbb3..aa2f9dbb3 100644 --- a/tests/compile/tgenericmatcher2.nim +++ b/tests/generics/tgenericmatcher2.nim diff --git a/tests/run/tgenericprocvar.nim b/tests/generics/tgenericprocvar.nim index 1eba81fec..1eba81fec 100644 --- a/tests/run/tgenericprocvar.nim +++ b/tests/generics/tgenericprocvar.nim diff --git a/tests/compile/tgenericprop.nim b/tests/generics/tgenericprop.nim index 7cddf5617..7cddf5617 100644 --- a/tests/compile/tgenericprop.nim +++ b/tests/generics/tgenericprop.nim diff --git a/tests/compile/tgenericrefs.nim b/tests/generics/tgenericrefs.nim index ef931dfa7..ef931dfa7 100644 --- a/tests/compile/tgenericrefs.nim +++ b/tests/generics/tgenericrefs.nim diff --git a/tests/generics/tgenericshardcases.nim b/tests/generics/tgenericshardcases.nim new file mode 100644 index 000000000..2ef63bc20 --- /dev/null +++ b/tests/generics/tgenericshardcases.nim @@ -0,0 +1,36 @@ +discard """ + file: "tgenericshardcases.nim" + output: "2\n5\n126\n3" +""" + +import typetraits + +proc typeNameLen(x: typedesc): int {.compileTime.} = + result = x.name.len + +macro selectType(a, b: typedesc): typedesc = + result = a + +type + Foo[T] = object + data1: array[T.high, int] + data2: array[typeNameLen(T), float] # data3: array[0..T.typeNameLen, selectType(float, int)] + + MyEnum = enum A, B, C, D + +var f1: Foo[MyEnum] +var f2: Foo[int8] + +echo high(f1.data1) # (D = 3) - 1 == 2 +echo high(f1.data2) # (MyEnum.len = 6) - 1 == 5 + +echo high(f2.data1) # 127 - 1 == 126 +echo high(f2.data2) # int8.len - 1 == 3 + +#static: +# assert high(f1.data1) == ord(D) +# assert high(f1.data2) == 6 # length of MyEnum + +# assert high(f2.data1) == 127 +# assert high(f2.data2) == 4 # length of int8 + diff --git a/tests/compile/tgenerictmpl.nim b/tests/generics/tgenerictmpl.nim index a749e6570..a749e6570 100644 --- a/tests/compile/tgenerictmpl.nim +++ b/tests/generics/tgenerictmpl.nim diff --git a/tests/compile/tgenericvariant.nim b/tests/generics/tgenericvariant.nim index 51d01355a..51d01355a 100644 --- a/tests/compile/tgenericvariant.nim +++ b/tests/generics/tgenericvariant.nim diff --git a/tests/compile/tspecialised_is_equivalent.nim b/tests/generics/tspecialised_is_equivalent.nim index 60b976e90..60b976e90 100644 --- a/tests/compile/tspecialised_is_equivalent.nim +++ b/tests/generics/tspecialised_is_equivalent.nim diff --git a/tests/compile/tthread_generic.nim b/tests/generics/tthread_generic.nim index beae4b652..beae4b652 100644 --- a/tests/compile/tthread_generic.nim +++ b/tests/generics/tthread_generic.nim diff --git a/tests/run/tvarargs_vs_generic.nim b/tests/generics/tvarargs_vs_generic.nim index 122f3e453..122f3e453 100644 --- a/tests/run/tvarargs_vs_generic.nim +++ b/tests/generics/tvarargs_vs_generic.nim diff --git a/tests/run/tgensym.nim b/tests/gensym/tgensym.nim index 3c85b0b83..3c85b0b83 100644 --- a/tests/run/tgensym.nim +++ b/tests/gensym/tgensym.nim diff --git a/tests/compile/tgensymgeneric.nim b/tests/gensym/tgensymgeneric.nim index 54390a4ef..54390a4ef 100644 --- a/tests/compile/tgensymgeneric.nim +++ b/tests/gensym/tgensymgeneric.nim diff --git a/tests/run/tglobal.nim b/tests/global/tglobal.nim index 84c4510c1..84c4510c1 100644 --- a/tests/run/tglobal.nim +++ b/tests/global/tglobal.nim diff --git a/tests/compile/tglobalforvar.nim b/tests/global/tglobalforvar.nim index af75df5c8..af75df5c8 100644 --- a/tests/compile/tglobalforvar.nim +++ b/tests/global/tglobalforvar.nim diff --git a/tests/compile/timplicititems.nim b/tests/implicit/timplicititems.nim index dbe321cb6..dbe321cb6 100644 --- a/tests/compile/timplicititems.nim +++ b/tests/implicit/timplicititems.nim diff --git a/tests/compile/timplictderef.nim b/tests/implicit/timplictderef.nim index 99b0b645b..99b0b645b 100644 --- a/tests/compile/timplictderef.nim +++ b/tests/implicit/timplictderef.nim diff --git a/tests/reject/tuninit1.nim b/tests/init/tuninit1.nim index 2a994b187..2a994b187 100644 --- a/tests/reject/tuninit1.nim +++ b/tests/init/tuninit1.nim diff --git a/tests/run/tzeroarray.nim b/tests/init/tzeroarray.nim index b784b601e..b784b601e 100644 --- a/tests/run/tzeroarray.nim +++ b/tests/init/tzeroarray.nim diff --git a/tests/iter/tanoniter1.nim b/tests/iter/tanoniter1.nim new file mode 100644 index 000000000..9db5ab8ec --- /dev/null +++ b/tests/iter/tanoniter1.nim @@ -0,0 +1,32 @@ +discard """ + output: '''1 +2 +3 +4 +1 +2''' +""" + +proc factory(a, b: int): iterator (): int = + iterator foo(): int = + var x = a + while x <= b: + yield x + inc x + return foo + +proc factory2(a, b: int): iterator (): int = + return iterator (): int = + var x = a + while x <= b: + yield x + inc x + +let foo = factory 1, 4 + +for f in foo(): + echo f + +let foo2 = factory2 1,2 + +for f in foo2(): echo f diff --git a/tests/run/tcountup.nim b/tests/iter/tcountup.nim index e68a614b0..e68a614b0 100644 --- a/tests/run/tcountup.nim +++ b/tests/iter/tcountup.nim diff --git a/tests/compile/titer.nim b/tests/iter/titer.nim index 19a11dc4e..19a11dc4e 100644 --- a/tests/compile/titer.nim +++ b/tests/iter/titer.nim diff --git a/tests/compile/titer2.nim b/tests/iter/titer2.nim index dab2713e8..f8967109e 100644 --- a/tests/compile/titer2.nim +++ b/tests/iter/titer2.nim @@ -1,6 +1,6 @@ discard """ output: '''true''' - cmd: "nimrod cc --gc:none --hints:on $# $#" + cmd: "nimrod cc --gc:none --hints:on --warnings:off $# $#" """ import hashes diff --git a/tests/run/titer3.nim b/tests/iter/titer3.nim index ab95dd7bd..ab95dd7bd 100644 --- a/tests/run/titer3.nim +++ b/tests/iter/titer3.nim diff --git a/tests/reject/titer4.nim b/tests/iter/titer4.nim index 9b52f8055..9b52f8055 100644 --- a/tests/reject/titer4.nim +++ b/tests/iter/titer4.nim diff --git a/tests/run/titer5.nim b/tests/iter/titer5.nim index bbd50fcb1..bbd50fcb1 100644 --- a/tests/run/titer5.nim +++ b/tests/iter/titer5.nim diff --git a/tests/run/titer6.nim b/tests/iter/titer6.nim index dceace0e0..dceace0e0 100644 --- a/tests/run/titer6.nim +++ b/tests/iter/titer6.nim diff --git a/tests/run/titer7.nim b/tests/iter/titer7.nim index d0337b7bd..d0337b7bd 100644 --- a/tests/run/titer7.nim +++ b/tests/iter/titer7.nim diff --git a/tests/run/titer8.nim b/tests/iter/titer8.nim index af0e643f1..af0e643f1 100644 --- a/tests/run/titer8.nim +++ b/tests/iter/titer8.nim diff --git a/tests/run/titer9.nim b/tests/iter/titer9.nim index 99874e70a..99874e70a 100644 --- a/tests/run/titer9.nim +++ b/tests/iter/titer9.nim diff --git a/tests/compile/titer_no_tuple_unpack.nim b/tests/iter/titer_no_tuple_unpack.nim index da5e1bc46..da5e1bc46 100644 --- a/tests/compile/titer_no_tuple_unpack.nim +++ b/tests/iter/titer_no_tuple_unpack.nim diff --git a/tests/compile/titerovl.nim b/tests/iter/titerovl.nim index be665b2b7..be665b2b7 100644 --- a/tests/compile/titerovl.nim +++ b/tests/iter/titerovl.nim diff --git a/tests/run/titerslice.nim b/tests/iter/titerslice.nim index e5d2e14a3..e5d2e14a3 100644 --- a/tests/run/titerslice.nim +++ b/tests/iter/titerslice.nim diff --git a/tests/run/titervaropenarray.nim b/tests/iter/titervaropenarray.nim index 1e70ce247..1e70ce247 100644 --- a/tests/run/titervaropenarray.nim +++ b/tests/iter/titervaropenarray.nim diff --git a/tests/run/tmoditer.nim b/tests/iter/tmoditer.nim index 1e6be37e4..1e6be37e4 100644 --- a/tests/run/tmoditer.nim +++ b/tests/iter/tmoditer.nim diff --git a/tests/reject/treciter.nim b/tests/iter/treciter.nim index dacdbdfd7..dacdbdfd7 100644 --- a/tests/reject/treciter.nim +++ b/tests/iter/treciter.nim diff --git a/tests/reject/twrongiter.nim b/tests/iter/twrongiter.nim index 2d2502a6a..33394219b 100644 --- a/tests/reject/twrongiter.nim +++ b/tests/iter/twrongiter.nim @@ -1,5 +1,5 @@ discard """ -line: 14 +line: 12 errormsg: "type mismatch" """ diff --git a/tests/reject/tlet.nim b/tests/let/tlet.nim index 3d36432fb..3d36432fb 100644 --- a/tests/reject/tlet.nim +++ b/tests/let/tlet.nim diff --git a/tests/reject/tlet2.nim b/tests/let/tlet2.nim index 8b1ddf940..8b1ddf940 100644 --- a/tests/reject/tlet2.nim +++ b/tests/let/tlet2.nim diff --git a/tests/run/thexlit.nim b/tests/lexer/thexlit.nim index 04a530c9c..04a530c9c 100644 --- a/tests/run/thexlit.nim +++ b/tests/lexer/thexlit.nim diff --git a/tests/compile/thexrange.nim b/tests/lexer/thexrange.nim index e5e4c10c6..e5e4c10c6 100644 --- a/tests/compile/thexrange.nim +++ b/tests/lexer/thexrange.nim diff --git a/tests/compile/tident.nim b/tests/lexer/tident.nim index 1ed9894c6..1ed9894c6 100644 --- a/tests/compile/tident.nim +++ b/tests/lexer/tident.nim diff --git a/tests/reject/tind1.nim b/tests/lexer/tind1.nim index f3fd952cc..f3fd952cc 100644 --- a/tests/reject/tind1.nim +++ b/tests/lexer/tind1.nim diff --git a/tests/run/tindent1.nim b/tests/lexer/tindent1.nim index 78a303783..78a303783 100644 --- a/tests/run/tindent1.nim +++ b/tests/lexer/tindent1.nim diff --git a/tests/compile/tlexer.nim b/tests/lexer/tlexer.nim index 10a8ab51d..10a8ab51d 100644 --- a/tests/compile/tlexer.nim +++ b/tests/lexer/tlexer.nim diff --git a/tests/reject/tmissingnl.nim b/tests/lexer/tmissingnl.nim index 33b7debf1..33b7debf1 100644 --- a/tests/reject/tmissingnl.nim +++ b/tests/lexer/tmissingnl.nim diff --git a/tests/run/tstrlits.nim b/tests/lexer/tstrlits.nim index 1cd43975a..1cd43975a 100644 --- a/tests/run/tstrlits.nim +++ b/tests/lexer/tstrlits.nim diff --git a/tests/reject/tunderscores.nim b/tests/lexer/tunderscores.nim index 8075fdae4..8075fdae4 100644 --- a/tests/reject/tunderscores.nim +++ b/tests/lexer/tunderscores.nim diff --git a/tests/run/tkoeniglookup.nim b/tests/lookups/tkoeniglookup.nim index e6f5c0112..e6f5c0112 100644 --- a/tests/run/tkoeniglookup.nim +++ b/tests/lookups/tkoeniglookup.nim diff --git a/tests/compile/tredef.nim b/tests/lookups/tredef.nim index 02d1f7776..02d1f7776 100644 --- a/tests/compile/tredef.nim +++ b/tests/lookups/tredef.nim diff --git a/tests/compile/tdumpast.nim b/tests/macros/tdumpast.nim index 55a964327..55a964327 100644 --- a/tests/compile/tdumpast.nim +++ b/tests/macros/tdumpast.nim diff --git a/tests/compile/tdumpast2.nim b/tests/macros/tdumpast2.nim index c6eab39a9..c6eab39a9 100644 --- a/tests/compile/tdumpast2.nim +++ b/tests/macros/tdumpast2.nim diff --git a/tests/run/tdumptree.nim b/tests/macros/tdumptree.nim index 5299a94e3..5299a94e3 100644 --- a/tests/run/tdumptree.nim +++ b/tests/macros/tdumptree.nim diff --git a/tests/run/tidgen.nim b/tests/macros/tidgen.nim index 2fe9e0f82..2fe9e0f82 100644 --- a/tests/run/tidgen.nim +++ b/tests/macros/tidgen.nim diff --git a/tests/compile/tmacro1.nim b/tests/macros/tmacro1.nim index 3a67c2611..3a67c2611 100644 --- a/tests/compile/tmacro1.nim +++ b/tests/macros/tmacro1.nim diff --git a/tests/run/tmacro2.nim b/tests/macros/tmacro2.nim index 8515322d5..8515322d5 100644 --- a/tests/run/tmacro2.nim +++ b/tests/macros/tmacro2.nim diff --git a/tests/run/tmacro3.nim b/tests/macros/tmacro3.nim index 162212326..162212326 100644 --- a/tests/run/tmacro3.nim +++ b/tests/macros/tmacro3.nim diff --git a/tests/run/tmacro4.nim b/tests/macros/tmacro4.nim index 10a23b159..10a23b159 100644 --- a/tests/run/tmacro4.nim +++ b/tests/macros/tmacro4.nim diff --git a/tests/compile/tmacro2.nim b/tests/macros/tmacro5.nim index e7bc648db..39324e497 100644 --- a/tests/compile/tmacro2.nim +++ b/tests/macros/tmacro5.nim @@ -26,7 +26,7 @@ macro importImpl_forward(name, returns): stmt {.immediate.} = p2.add newIdentNode("errors") p2.add newNimNode(nnkVarTy) p2.add newNimNode(nnkEmpty) - p2[1].add newNimNOde(nnkBracketExpr) + p2[1].add newNimNode(nnkBracketExpr) p2[1][0].add newIdentNode("seq") p2[1][0].add newIdentNode("string") res[3].add p2 diff --git a/tests/compile/tmacroaspragma.nim b/tests/macros/tmacroaspragma.nim index 0e5c352b3..0e5c352b3 100644 --- a/tests/compile/tmacroaspragma.nim +++ b/tests/macros/tmacroaspragma.nim diff --git a/tests/run/tmacrogenerics.nim b/tests/macros/tmacrogenerics.nim index 5ae59e0da..5ae59e0da 100644 --- a/tests/run/tmacrogenerics.nim +++ b/tests/macros/tmacrogenerics.nim diff --git a/tests/run/tmacros1.nim b/tests/macros/tmacros1.nim index 3c814ad6d..3c814ad6d 100644 --- a/tests/run/tmacros1.nim +++ b/tests/macros/tmacros1.nim diff --git a/tests/compile/tmacrostmt.nim b/tests/macros/tmacrostmt.nim index d9c70197d..d9c70197d 100644 --- a/tests/compile/tmacrostmt.nim +++ b/tests/macros/tmacrostmt.nim diff --git a/tests/compile/tmacrotypes.nim b/tests/macros/tmacrotypes.nim index 7697dba27..7697dba27 100644 --- a/tests/compile/tmacrotypes.nim +++ b/tests/macros/tmacrotypes.nim diff --git a/tests/macros/tmemit.nim b/tests/macros/tmemit.nim new file mode 100644 index 000000000..e4bb2daed --- /dev/null +++ b/tests/macros/tmemit.nim @@ -0,0 +1,7 @@ +discard """ + out: '''HELLO WORLD''' +""" + +import macros, strutils + +emit("echo " & '"' & "hello world".toUpper & '"') diff --git a/tests/compile/tnimrodnode_for_runtime.nim b/tests/macros/tnimrodnode_for_runtime.nim index e73c8430f..e73c8430f 100644 --- a/tests/compile/tnimrodnode_for_runtime.nim +++ b/tests/macros/tnimrodnode_for_runtime.nim diff --git a/tests/run/tprintf.nim b/tests/macros/tprintf.nim index c8fb51cdc..c8fb51cdc 100644 --- a/tests/run/tprintf.nim +++ b/tests/macros/tprintf.nim diff --git a/tests/run/tquotewords.nim b/tests/macros/tquotewords.nim index 76b8d8af7..76b8d8af7 100644 --- a/tests/run/tquotewords.nim +++ b/tests/macros/tquotewords.nim diff --git a/tests/reject/trecmacro.nim b/tests/macros/trecmacro.nim index 28b6db530..28b6db530 100644 --- a/tests/reject/trecmacro.nim +++ b/tests/macros/trecmacro.nim diff --git a/tests/run/tstringinterp.nim b/tests/macros/tstringinterp.nim index f030213e0..f030213e0 100644 --- a/tests/run/tstringinterp.nim +++ b/tests/macros/tstringinterp.nim diff --git a/tests/run/tvtable.nim b/tests/macros/tvtable.nim index 51894618c..51894618c 100644 --- a/tests/run/tvtable.nim +++ b/tests/macros/tvtable.nim diff --git a/tests/run/tlowhigh.nim b/tests/magics/tlowhigh.nim index d1cbd3272..d1cbd3272 100644 --- a/tests/run/tlowhigh.nim +++ b/tests/magics/tlowhigh.nim diff --git a/tests/run/tmatrix.nim b/tests/matrix/tmatrix.nim index 90dfde959..90dfde959 100644 --- a/tests/run/tmatrix.nim +++ b/tests/matrix/tmatrix.nim diff --git a/tests/compile/tmatrix1.nim b/tests/matrix/tmatrix1.nim index 0adf30b57..0adf30b57 100644 --- a/tests/compile/tmatrix1.nim +++ b/tests/matrix/tmatrix1.nim diff --git a/tests/compile/tmatrix2.nim b/tests/matrix/tmatrix2.nim index 442096e93..442096e93 100644 --- a/tests/compile/tmatrix2.nim +++ b/tests/matrix/tmatrix2.nim diff --git a/tests/metatype/tbindtypedesc.nim b/tests/metatype/tbindtypedesc.nim new file mode 100644 index 000000000..5ea8cf063 --- /dev/null +++ b/tests/metatype/tbindtypedesc.nim @@ -0,0 +1,91 @@ +discard """ + msg: ''' +int +float +TFoo +TFoo +''' +""" + +import typetraits + +type + TFoo = object + x, y: int + + TBar = tuple + x, y: int + +template accept(e: expr) = + static: assert(compiles(e)) + +template reject(e: expr) = + static: assert(not compiles(e)) + +proc genericParamRepeated[T: typedesc](a: T, b: T) = + static: + echo a.name + echo b.name + +accept genericParamRepeated(int, int) +accept genericParamRepeated(float, float) + +reject genericParamRepeated(string, int) +reject genericParamRepeated(int, float) + +proc genericParamOnce[T: typedesc](a, b: T) = + static: + echo a.name + echo b.name + +accept genericParamOnce(int, int) +accept genericParamOnce(TFoo, TFoo) + +reject genericParamOnce(string, int) +reject genericParamOnce(TFoo, float) + +type + type1 = typedesc + type2 = typedesc + +proc typePairs(A, B: type1; C, D: type2) = nil + +accept typePairs(int, int, TFoo, TFOO) +accept typePairs(TBAR, TBar, TBAR, TBAR) +accept typePairs(int, int, string, string) + +reject typePairs(TBAR, TBar, TBar, TFoo) +reject typePairs(string, int, TBAR, TBAR) + +proc typePairs2[T: typedesc, U: typedesc](A, B: T; C, D: U) = nil + +accept typePairs2(int, int, TFoo, TFOO) +accept typePairs2(TBAR, TBar, TBAR, TBAR) +accept typePairs2(int, int, string, string) + +reject typePairs2(TBAR, TBar, TBar, TFoo) +reject typePairs2(string, int, TBAR, TBAR) + +proc dontBind(a: typedesc, b: typedesc) = + static: + echo a.name + echo b.name + +accept dontBind(int, float) +accept dontBind(TFoo, TFoo) + +proc dontBind2(a, b: typedesc) = nil + +accept dontBind2(int, float) +accept dontBind2(TBar, int) + +proc bindArg(T: typedesc, U: typedesc, a, b: T, c, d: U) = nil + +accept bindArg(int, string, 10, 20, "test", "nest") +accept bindArg(int, int, 10, 20, 30, 40) + +reject bindArg(int, string, 10, "test", "test", "nest") +reject bindArg(int, int, 10, 20, 30, "test") +reject bindArg(int, string, 10.0, 20, "test", "nest") +reject bindArg(int, string, "test", "nest", 10, 20) + diff --git a/tests/metatype/tcompositetypeclasses.nim b/tests/metatype/tcompositetypeclasses.nim new file mode 100644 index 000000000..a2db73769 --- /dev/null +++ b/tests/metatype/tcompositetypeclasses.nim @@ -0,0 +1,59 @@ +template accept(e) = + static: assert(compiles(e)) + +template reject(e) = + static: assert(not compiles(e)) + +type + TFoo[T, U] = tuple + x: T + y: U + + TBar[K] = TFoo[K, K] + + TUserClass = int|string + + TBaz = TBar[TUserClass] + +var + vfoo: TFoo[int, string] + vbar: TFoo[string, string] + vbaz: TFoo[int, int] + vnotbaz: TFoo[TObject, TObject] + +proc foo(x: TFoo) = echo "foo" +proc bar(x: TBar) = echo "bar" +proc baz(x: TBaz) = echo "baz" + +accept foo(vfoo) +accept bar(vbar) +accept baz(vbar) +accept baz(vbaz) + +reject baz(vnotbaz) +reject bar(vfoo) + +# https://github.com/Araq/Nimrod/issues/517 +type + TVecT*[T] = array[0..1, T]|array[0..2, T]|array[0..3, T] + TVec2* = array[0..1, float32] + +proc f[T](a: TVecT[T], b: TVecT[T]): T = discard + +var x: float = f([0.0'f32, 0.0'f32], [0.0'f32, 0.0'f32]) +var y = f(TVec2([0.0'f32, 0.0'f32]), TVec2([0.0'f32, 0.0'f32])) + +# https://github.com/Araq/Nimrod/issues/602 +type + TTest = object + TTest2* = object + TUnion = TTest | TTest2 + +proc f(src: ptr TUnion, dst: ptr TUnion) = + echo("asd") + +var tx: TTest +var ty: TTest2 + +accept f(addr tx, addr tx) +reject f(addr tx, addr ty) diff --git a/tests/compile/tconstraints.nim b/tests/metatype/tconstraints.nim index 7aef0d645..7aef0d645 100644 --- a/tests/compile/tconstraints.nim +++ b/tests/metatype/tconstraints.nim diff --git a/tests/metatype/tsemistatic.nim b/tests/metatype/tsemistatic.nim new file mode 100644 index 000000000..d187f153c --- /dev/null +++ b/tests/metatype/tsemistatic.nim @@ -0,0 +1,24 @@ +discard """ + msg: "static 10\ndynamic\nstatic 20\n" + output: "s\nd\nd\ns" +""" + +proc foo(x: semistatic[int]) = + when isStatic(x): + static: echo "static ", x + echo "s" + else: + static: echo "dynamic" + echo "d" + +foo 10 + +var + x = 10 + y: int + +foo x +foo y + +foo 20 + diff --git a/tests/run/tstaticparams.nim b/tests/metatype/tstaticparams.nim index f2d6e1dd6..b1377443b 100644 --- a/tests/run/tstaticparams.nim +++ b/tests/metatype/tstaticparams.nim @@ -4,15 +4,15 @@ discard """ """ type - TFoo[T; Val: expr[string]] = object + TFoo[T; Val: static[string]] = object data: array[4, T] - TBar[T; I: expr[int]] = object + TBar[T; I: static[int]] = object data: array[I, T] - TA1[T; I: expr[int]] = array[I, T] - TA2[T; I: expr[int]] = array[0..I, T] - TA3[T; I: expr[int]] = array[I-1, T] + TA1[T; I: static[int]] = array[I, T] + # TA2[T; I: static[int]] = array[0..I, T] + # TA3[T; I: static[int]] = array[I-1, T] proc takeFoo(x: TFoo) = echo "abracadabra" @@ -25,7 +25,7 @@ var y: TBar[float, 4] echo high(y.data) var - t1: TA1 - t2: TA2 - t3: TA3 + t1: TA1[float, 1] + # t2: TA2[string, 4] + # t3: TA3[int, 10] diff --git a/tests/metatype/ttypebar.nim b/tests/metatype/ttypebar.nim new file mode 100644 index 000000000..304dfffcb --- /dev/null +++ b/tests/metatype/ttypebar.nim @@ -0,0 +1,14 @@ + +# bug #602 + +type + TTest = object + TTest2* = object + TFoo = TTest | TTest2 + +proc f(src: ptr TFoo, dst: ptr TFoo) = + echo("asd") + +var x: TTest +f(addr x, addr x) + diff --git a/tests/compile/ttypeclasses.nim b/tests/metatype/ttypeclasses.nim index 677229868..677229868 100644 --- a/tests/compile/ttypeclasses.nim +++ b/tests/metatype/ttypeclasses.nim diff --git a/tests/run/ttypedesc1.nim b/tests/metatype/ttypedesc1.nim index 0c6f5dce4..0c6f5dce4 100644 --- a/tests/run/ttypedesc1.nim +++ b/tests/metatype/ttypedesc1.nim diff --git a/tests/compile/ttypeselectors.nim b/tests/metatype/ttypeselectors.nim index cca643e1f..cca643e1f 100644 --- a/tests/compile/ttypeselectors.nim +++ b/tests/metatype/ttypeselectors.nim diff --git a/tests/run/ttypetraits.nim b/tests/metatype/ttypetraits.nim index 9a4a7d0d3..4344855eb 100644 --- a/tests/run/ttypetraits.nim +++ b/tests/metatype/ttypetraits.nim @@ -1,6 +1,6 @@ discard """ msg: "int\nstring\nTBar[int]" - output: "int\nstring\nTBar[int]\nint\nrange 0..2\nstring" + output: "int\nstring\nTBar[int]\nint\nrange 0..2(int)\nstring" """ import typetraits diff --git a/tests/run/tusertypeclasses.nim b/tests/metatype/tusertypeclasses.nim index 4c2f07b85..4c2f07b85 100644 --- a/tests/run/tusertypeclasses.nim +++ b/tests/metatype/tusertypeclasses.nim diff --git a/tests/run/utypeclasses.nim b/tests/metatype/utypeclasses.nim index 06bab375e..06bab375e 100644 --- a/tests/run/utypeclasses.nim +++ b/tests/metatype/utypeclasses.nim diff --git a/tests/run/mmultim3.nim b/tests/method/mmultim3.nim index 3139a8089..3139a8089 100644 --- a/tests/run/mmultim3.nim +++ b/tests/method/mmultim3.nim diff --git a/tests/reject/tmethod.nim b/tests/method/tmethod.nim index 0cfe24c70..0cfe24c70 100644 --- a/tests/reject/tmethod.nim +++ b/tests/method/tmethod.nim diff --git a/tests/run/tmethods1.nim b/tests/method/tmethods1.nim index f4add6af4..f4add6af4 100644 --- a/tests/run/tmethods1.nim +++ b/tests/method/tmethods1.nim diff --git a/tests/run/tmultim1.nim b/tests/method/tmultim1.nim index 7f551aa64..7f551aa64 100644 --- a/tests/run/tmultim1.nim +++ b/tests/method/tmultim1.nim diff --git a/tests/run/tmultim2.nim b/tests/method/tmultim2.nim index 75f652137..75f652137 100644 --- a/tests/run/tmultim2.nim +++ b/tests/method/tmultim2.nim diff --git a/tests/run/tmultim3.nim b/tests/method/tmultim3.nim index 373c84c0e..373c84c0e 100644 --- a/tests/run/tmultim3.nim +++ b/tests/method/tmultim3.nim diff --git a/tests/run/tmultim4.nim b/tests/method/tmultim4.nim index d824086b2..d824086b2 100644 --- a/tests/run/tmultim4.nim +++ b/tests/method/tmultim4.nim diff --git a/tests/run/tmultim6.nim b/tests/method/tmultim6.nim index 5f45f572a..5f45f572a 100644 --- a/tests/run/tmultim6.nim +++ b/tests/method/tmultim6.nim diff --git a/tests/run/tsimmeth.nim b/tests/method/tsimmeth.nim index 11ff2674f..11ff2674f 100644 --- a/tests/run/tsimmeth.nim +++ b/tests/method/tsimmeth.nim diff --git a/tests/reject/mopaque.nim b/tests/module/mopaque.nim index 7eee4bd96..7eee4bd96 100644 --- a/tests/reject/mopaque.nim +++ b/tests/module/mopaque.nim diff --git a/tests/compile/mrecmod.nim b/tests/module/mrecmod.nim index fab9654d5..fab9654d5 100644 --- a/tests/compile/mrecmod.nim +++ b/tests/module/mrecmod.nim diff --git a/tests/compile/mrecmod2.nim b/tests/module/mrecmod2.nim index 9557ce729..9557ce729 100644 --- a/tests/compile/mrecmod2.nim +++ b/tests/module/mrecmod2.nim diff --git a/tests/reject/topaque.nim b/tests/module/topaque.nim index f0587c959..f0587c959 100644 --- a/tests/reject/topaque.nim +++ b/tests/module/topaque.nim diff --git a/tests/reject/trecinca.nim b/tests/module/trecinca.nim index 73a0ec937..73a0ec937 100644 --- a/tests/reject/trecinca.nim +++ b/tests/module/trecinca.nim diff --git a/tests/reject/trecincb.nim b/tests/module/trecincb.nim index 9dd7d51de..9dd7d51de 100644 --- a/tests/reject/trecincb.nim +++ b/tests/module/trecincb.nim diff --git a/tests/compile/trecmod.nim b/tests/module/trecmod.nim index 9d39d3ff7..9d39d3ff7 100644 --- a/tests/compile/trecmod.nim +++ b/tests/module/trecmod.nim diff --git a/tests/compile/trecmod2.nim b/tests/module/trecmod2.nim index 85fe2215f..85fe2215f 100644 --- a/tests/compile/trecmod2.nim +++ b/tests/module/trecmod2.nim diff --git a/tests/compile/mexporta.nim b/tests/modules/mexporta.nim index b7d4ddec9..b7d4ddec9 100644 --- a/tests/compile/mexporta.nim +++ b/tests/modules/mexporta.nim diff --git a/tests/compile/mexportb.nim b/tests/modules/mexportb.nim index 10d89f388..10d89f388 100644 --- a/tests/compile/mexportb.nim +++ b/tests/modules/mexportb.nim diff --git a/tests/compile/texport.nim b/tests/modules/texport.nim index 99228dfce..99228dfce 100644 --- a/tests/compile/texport.nim +++ b/tests/modules/texport.nim diff --git a/tests/reject/timportexcept.nim b/tests/modules/timportexcept.nim index 93a7fd642..93a7fd642 100644 --- a/tests/reject/timportexcept.nim +++ b/tests/modules/timportexcept.nim diff --git a/tests/reject/tnamedparams.nim b/tests/namedparams/tnamedparams.nim index 9397fea4a..9397fea4a 100644 --- a/tests/reject/tnamedparams.nim +++ b/tests/namedparams/tnamedparams.nim diff --git a/tests/compile/tnamedparams.nim b/tests/namedparams/tnamedparams2.nim index 4b0cd5361..4b0cd5361 100644 --- a/tests/compile/tnamedparams.nim +++ b/tests/namedparams/tnamedparams2.nim diff --git a/tests/reject/mnamspc1.nim b/tests/namspc/mnamspc1.nim index da13c5f24..da13c5f24 100644 --- a/tests/reject/mnamspc1.nim +++ b/tests/namspc/mnamspc1.nim diff --git a/tests/reject/mnamspc2.nim b/tests/namspc/mnamspc2.nim index 84ef8533e..84ef8533e 100644 --- a/tests/reject/mnamspc2.nim +++ b/tests/namspc/mnamspc2.nim diff --git a/tests/reject/tnamspc.nim b/tests/namspc/tnamspc.nim index 1e2049cec..1e2049cec 100644 --- a/tests/reject/tnamspc.nim +++ b/tests/namspc/tnamspc.nim diff --git a/tests/reject/tnotnil.nim b/tests/notnil/tnotnil.nim index fba7fa917..fba7fa917 100644 --- a/tests/reject/tnotnil.nim +++ b/tests/notnil/tnotnil.nim diff --git a/tests/reject/tnotnil1.nim b/tests/notnil/tnotnil1.nim index 863fe45f8..863fe45f8 100644 --- a/tests/reject/tnotnil1.nim +++ b/tests/notnil/tnotnil1.nim diff --git a/tests/reject/tnotnil2.nim b/tests/notnil/tnotnil2.nim index bd6b8b675..bd6b8b675 100644 --- a/tests/reject/tnotnil2.nim +++ b/tests/notnil/tnotnil2.nim diff --git a/tests/run/tobjconstr.nim b/tests/objects/tobjconstr.nim index 3bd785728..3bd785728 100644 --- a/tests/run/tobjconstr.nim +++ b/tests/objects/tobjconstr.nim diff --git a/tests/compile/tobjconstr2.nim b/tests/objects/tobjconstr2.nim index cb47e146d..cb47e146d 100644 --- a/tests/compile/tobjconstr2.nim +++ b/tests/objects/tobjconstr2.nim diff --git a/tests/compile/tobjcov.nim b/tests/objects/tobjcov.nim index fc44edf8e..fc44edf8e 100644 --- a/tests/compile/tobjcov.nim +++ b/tests/objects/tobjcov.nim diff --git a/tests/run/tobject.nim b/tests/objects/tobject.nim index 5fec84441..5fec84441 100644 --- a/tests/run/tobject.nim +++ b/tests/objects/tobject.nim diff --git a/tests/compile/tobject2.nim b/tests/objects/tobject2.nim index 0f1869695..0f1869695 100644 --- a/tests/compile/tobject2.nim +++ b/tests/objects/tobject2.nim diff --git a/tests/compile/tobject3.nim b/tests/objects/tobject3.nim index 935e6ca8c..935e6ca8c 100644 --- a/tests/compile/tobject3.nim +++ b/tests/objects/tobject3.nim diff --git a/tests/compile/tobjects.nim b/tests/objects/tobjects.nim index 06fa15583..06fa15583 100644 --- a/tests/compile/tobjects.nim +++ b/tests/objects/tobjects.nim diff --git a/tests/run/tofopr.nim b/tests/objects/tofopr.nim index 961d81bd3..961d81bd3 100644 --- a/tests/run/tofopr.nim +++ b/tests/objects/tofopr.nim diff --git a/tests/compile/toop.nim b/tests/objects/toop.nim index 0b42c2c22..0b42c2c22 100644 --- a/tests/compile/toop.nim +++ b/tests/objects/toop.nim diff --git a/tests/run/toop1.nim b/tests/objects/toop1.nim index 350799f51..350799f51 100644 --- a/tests/run/toop1.nim +++ b/tests/objects/toop1.nim diff --git a/tests/reject/tadrdisc.nim b/tests/objvariant/tadrdisc.nim index 0e0324562..0e0324562 100644 --- a/tests/reject/tadrdisc.nim +++ b/tests/objvariant/tadrdisc.nim diff --git a/tests/reject/tcheckedfield1.nim b/tests/objvariant/tcheckedfield1.nim index 5ade3a13a..5ade3a13a 100644 --- a/tests/reject/tcheckedfield1.nim +++ b/tests/objvariant/tcheckedfield1.nim diff --git a/tests/reject/temptycaseobj.nim b/tests/objvariant/temptycaseobj.nim index 5c012746e..5c012746e 100644 --- a/tests/reject/temptycaseobj.nim +++ b/tests/objvariant/temptycaseobj.nim diff --git a/tests/run/tvariantstack.nim b/tests/objvariant/tvariantstack.nim index d81f6e001..d81f6e001 100644 --- a/tests/run/tvariantstack.nim +++ b/tests/objvariant/tvariantstack.nim diff --git a/tests/reject/topena1.nim b/tests/openarray/topena1.nim index 0dbc5506a..0dbc5506a 100644 --- a/tests/reject/topena1.nim +++ b/tests/openarray/topena1.nim diff --git a/tests/run/topenarrayrepr.nim b/tests/openarray/topenarrayrepr.nim index d276756bc..d276756bc 100644 --- a/tests/run/topenarrayrepr.nim +++ b/tests/openarray/topenarrayrepr.nim diff --git a/tests/run/topenlen.nim b/tests/openarray/topenlen.nim index fec8e87b7..fec8e87b7 100644 --- a/tests/run/topenlen.nim +++ b/tests/openarray/topenlen.nim diff --git a/tests/run/toverflw.nim b/tests/overflw/toverflw.nim index cd7b65acf..cd7b65acf 100644 --- a/tests/run/toverflw.nim +++ b/tests/overflw/toverflw.nim diff --git a/tests/run/toverflw2.nim b/tests/overflw/toverflw2.nim index f7fe3d574..f7fe3d574 100644 --- a/tests/run/toverflw2.nim +++ b/tests/overflw/toverflw2.nim diff --git a/tests/run/tovfint.nim b/tests/overflw/tovfint.nim index f0b1ccaa6..f0b1ccaa6 100644 --- a/tests/run/tovfint.nim +++ b/tests/overflw/tovfint.nim diff --git a/tests/reject/toverl.nim b/tests/overload/toverl.nim index 807b643a4..807b643a4 100644 --- a/tests/reject/toverl.nim +++ b/tests/overload/toverl.nim diff --git a/tests/run/toverl2.nim b/tests/overload/toverl2.nim index ea0249e9f..ea0249e9f 100644 --- a/tests/run/toverl2.nim +++ b/tests/overload/toverl2.nim diff --git a/tests/run/toverl3.nim b/tests/overload/toverl3.nim index b3e0f2fa7..b3e0f2fa7 100644 --- a/tests/run/toverl3.nim +++ b/tests/overload/toverl3.nim diff --git a/tests/compile/toverprc.nim b/tests/overload/toverprc.nim index 22b64ed48..22b64ed48 100644 --- a/tests/compile/toverprc.nim +++ b/tests/overload/toverprc.nim diff --git a/tests/run/toverwr.nim b/tests/overload/toverwr.nim index ef25e8913..ef25e8913 100644 --- a/tests/run/toverwr.nim +++ b/tests/overload/toverwr.nim diff --git a/tests/parser/tcommand_as_expr.nim b/tests/parser/tcommand_as_expr.nim new file mode 100644 index 000000000..f6868a2fc --- /dev/null +++ b/tests/parser/tcommand_as_expr.nim @@ -0,0 +1,12 @@ +discard """ + output: "12" +""" + +proc foo(x: int): int = x-1 +proc foo(x, y: int): int = x-y + +let x = foo 7.foo, # comment here + foo(1, foo 8) +# 12 = 6 - -6 +echo x + diff --git a/tests/run/tdomulttest.nim b/tests/parser/tdomulttest.nim index 4ee6de128..4ee6de128 100644 --- a/tests/run/tdomulttest.nim +++ b/tests/parser/tdomulttest.nim diff --git a/tests/reject/tinvwhen.nim b/tests/parser/tinvwhen.nim index ea8a7ddf0..5ff94cc6c 100644 --- a/tests/reject/tinvwhen.nim +++ b/tests/parser/tinvwhen.nim @@ -5,9 +5,9 @@ discard """ """ # This was parsed even though it should not! -proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".} +proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".} -proc getcwd(buf: CString, buflen: cint): CString +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/run/toprprec.nim b/tests/parser/toprprec.nim index ce33934b5..ce33934b5 100644 --- a/tests/run/toprprec.nim +++ b/tests/parser/toprprec.nim diff --git a/tests/run/tprecedence.nim b/tests/parser/tprecedence.nim index 6b1b250a2..6b1b250a2 100644 --- a/tests/run/tprecedence.nim +++ b/tests/parser/tprecedence.nim diff --git a/tests/patterns/tor.nim b/tests/patterns/tor.nim index 7de1a7fa1..833418919 100644 --- a/tests/patterns/tor.nim +++ b/tests/patterns/tor.nim @@ -1,5 +1,5 @@ discard """ - output: '''110 + output: '''3060 true''' """ diff --git a/tests/run/tpatterns.nim b/tests/patterns/tpatterns.nim index 6bc8772e3..6bc8772e3 100644 --- a/tests/run/tpatterns.nim +++ b/tests/patterns/tpatterns.nim diff --git a/tests/compile/tpush.nim b/tests/pragmas/tpush.nim index 5fb411a79..5fb411a79 100644 --- a/tests/compile/tpush.nim +++ b/tests/pragmas/tpush.nim diff --git a/tests/compile/tuserpragma.nim b/tests/pragmas/tuserpragma.nim index 784baa176..784baa176 100644 --- a/tests/compile/tuserpragma.nim +++ b/tests/pragmas/tuserpragma.nim diff --git a/tests/run/tnestprc.nim b/tests/proc/tnestprc.nim index c10ad6abf..c10ad6abf 100644 --- a/tests/run/tnestprc.nim +++ b/tests/proc/tnestprc.nim diff --git a/tests/reject/tprocredef.nim b/tests/proc/tprocredef.nim index 86ed92b62..86ed92b62 100644 --- a/tests/reject/tprocredef.nim +++ b/tests/proc/tprocredef.nim diff --git a/tests/compile/tgenericprocvar.nim b/tests/procvar/tgenericprocvar.nim index e642e3577..e642e3577 100644 --- a/tests/compile/tgenericprocvar.nim +++ b/tests/procvar/tgenericprocvar.nim diff --git a/tests/reject/tprocvar.nim b/tests/procvar/tprocvar.nim index 56f76c613..56f76c613 100644 --- a/tests/reject/tprocvar.nim +++ b/tests/procvar/tprocvar.nim diff --git a/tests/run/tprocvar.nim b/tests/procvar/tprocvar2.nim index 237e2ef7a..237e2ef7a 100644 --- a/tests/run/tprocvar.nim +++ b/tests/procvar/tprocvar2.nim diff --git a/tests/compile/tprocvars.nim b/tests/procvar/tprocvars.nim index dc7592526..dc7592526 100644 --- a/tests/compile/tprocvars.nim +++ b/tests/procvar/tprocvars.nim diff --git a/tests/range/compilehelpers.nim b/tests/range/compilehelpers.nim new file mode 100644 index 000000000..cb26ca5b5 --- /dev/null +++ b/tests/range/compilehelpers.nim @@ -0,0 +1,6 @@ +template accept(e: expr) = + static: assert(compiles(e)) + +template reject(e: expr) = + static: assert(not compiles(e)) + diff --git a/tests/run/tbug499771.nim b/tests/range/tbug499771.nim index 682148422..682148422 100644 --- a/tests/run/tbug499771.nim +++ b/tests/range/tbug499771.nim diff --git a/tests/compile/tcolors.nim b/tests/range/tcolors.nim index 9d1034405..9d1034405 100644 --- a/tests/compile/tcolors.nim +++ b/tests/range/tcolors.nim diff --git a/tests/range/tmatrix3.nim b/tests/range/tmatrix3.nim new file mode 100644 index 000000000..900404524 --- /dev/null +++ b/tests/range/tmatrix3.nim @@ -0,0 +1,41 @@ +discard """ + output: '''0.0000000000000000e+00 +0.0000000000000000e+00 +0 +0 +0 +''' +""" + +include compilehelpers + +type + Matrix*[M, N, T] = object + aij*: array[M, array[N, T]] + + Matrix2*[T] = Matrix[range[0..1], range[0..1], T] + + Matrix3*[T] = Matrix[range[0..2], range[0..2], T] + +proc mn(x: Matrix): Matrix.T = x.aij[0][0] + +proc m2(x: Matrix2): Matrix2.T = x.aij[0][0] + +proc m3(x: Matrix3): auto = x.aij[0][0] + +var + matn: Matrix[range[0..3], range[0..2], int] + mat2: Matrix2[int] + mat3: Matrix3[float] + +echo m3(mat3) +echo mn(mat3) +echo m2(mat2) +echo mn(mat2) +echo mn(matn) + +reject m3(mat2) +reject m3(matn) +reject m2(mat3) +reject m2(matn) + diff --git a/tests/reject/tsubrange.nim b/tests/range/tsubrange.nim index b4a333bf3..b4a333bf3 100644 --- a/tests/reject/tsubrange.nim +++ b/tests/range/tsubrange.nim diff --git a/tests/run/tsubrange2.nim b/tests/range/tsubrange2.nim index 51598713b..51598713b 100644 --- a/tests/run/tsubrange2.nim +++ b/tests/range/tsubrange2.nim diff --git a/tests/run/tsubrange.nim b/tests/range/tsubrange3.nim index b3e02fd29..b3e02fd29 100644 --- a/tests/run/tsubrange.nim +++ b/tests/range/tsubrange3.nim diff --git a/tests/reject/99bottles.nim b/tests/reject/99bottles.nim deleted file mode 100644 index 14904ac0f..000000000 --- a/tests/reject/99bottles.nim +++ /dev/null @@ -1 +0,0 @@ -# Test if the compiler detects invalid module names diff --git a/tests/reject/mbind4.nim b/tests/reject/mbind4.nim deleted file mode 100644 index 53b8331cd..000000000 --- a/tests/reject/mbind4.nim +++ /dev/null @@ -1,9 +0,0 @@ -# Module A -var - lastId = 0 - -template genId*: expr = - inc(lastId) - lastId - - diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim deleted file mode 100644 index 7ebfd61e9..000000000 --- a/tests/reject/t99bott.nim +++ /dev/null @@ -1,36 +0,0 @@ -discard """ - file: "t99bott.nim" - line: 26 - errormsg: "constant expression expected" - disabled: false -""" -## 99 Bottles of Beer -## http://www.99-bottles-of-beer.net/ -## Nimrod version - -## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr -# 2012-11-25 -# Loosely based on my old Lua version... Updated to current official lyrics. - -proc GetBottleNumber(n: int): string = - var bs: string - if n == 0: - bs = "No more bottles" - elif n == 1: - bs = "1 bottle" - else: - bs = $n & " bottles" - return bs & " of beer" - -for bn in countdown(99, 1): - const cur = GetBottleNumber(bn) - echo(cur, " on the wall, ", cur, ".") - echo("Take one down and pass it around, ", GetBottleNumber(bn-1), - " on the wall.\n") - -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/tatomic.nim b/tests/reject/tatomic.nim deleted file mode 100644 index 1fa0cff8d..000000000 --- a/tests/reject/tatomic.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tatomic.nim" - line: 7 - errormsg: "identifier expected, but found 'keyword atomic'" -""" -var - atomic: int - -echo atomic - - - diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim deleted file mode 100644 index a0ba88e7c..000000000 --- a/tests/reject/tbind4.nim +++ /dev/null @@ -1,13 +0,0 @@ -discard """ - file: "mbind4.nim" - line: 6 - errormsg: "undeclared identifier: \'lastId\'" -""" -# Module B -import mbind4 - -echo genId() - - - - diff --git a/tests/reject/tgenconstraints.nim b/tests/reject/tgenconstraints.nim deleted file mode 100644 index e32aa877b..000000000 --- a/tests/reject/tgenconstraints.nim +++ /dev/null @@ -1,30 +0,0 @@ -discard """ - file: "tgenconstraints.nim" - line: 25 - errormsg: "cannot instantiate T2" -""" - -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) - -proc bar(x: string|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/reject/tinc.nim b/tests/reject/tinc.nim deleted file mode 100644 index 8038a2a01..000000000 --- a/tests/reject/tinc.nim +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 034c496f5..000000000 --- a/tests/reject/tinout.nim +++ /dev/null @@ -1,16 +0,0 @@ -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) = - x = 0 - -proc b() = - abc(3) #ERROR - -b() - - diff --git a/tests/reject/tinvalidarrayaccess.nim b/tests/reject/tinvalidarrayaccess.nim deleted file mode 100644 index 03105b41b..000000000 --- a/tests/reject/tinvalidarrayaccess.nim +++ /dev/null @@ -1,14 +0,0 @@ -discard """ - errormsg: "index out of bounds" - line: 11 -""" - - -type TTestArr = array[0..1, int16] -var f: TTestArr -f[0] = 30 -f[1] = 40 -f[2] = 50 -f[3] = 60 - -echo(repr(f)) diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim deleted file mode 100644 index 957a25560..000000000 --- a/tests/reject/tinvalidnewseq.nim +++ /dev/null @@ -1,27 +0,0 @@ -discard """ - file: "tinvalidnewseq.nim" - line: 15 - errormsg: "type mismatch: got (array[0..6, string], int literal(7))" -""" -import re, strutils - -type - TURL = tuple[protocol, subdomain, domain, port: string, path: seq[string]] - -proc parseURL(url: string): TURL = - #([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)? - var pattern: string = r"([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)?" - var m: array[0..6, string] #Array with the matches - newSeq(m, 7) #ERROR - discard regexprs.match(url, re(pattern), m) - - result = (protocol: m[1], subdomain: m[2], domain: m[3] & m[4], - port: m[5], path: m[6].split('/')) - -var r: TUrl - -r = parseUrl(r"http://google.com/search?var=bleahdhsad") -echo(r.domain) - - - diff --git a/tests/reject/tnoinst.nim b/tests/reject/tnoinst.nim deleted file mode 100644 index 23a4145e0..000000000 --- a/tests/reject/tnoinst.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - line: 12 - errormsg: "instantiate 'notConcrete' explicitely" -""" - -proc wrap[T]() = - proc notConcrete[T](x, y: int): int = - var dummy: T - result = x - y - - var x: proc (x, y: T): int - x = notConcrete - - -wrap[int]() - diff --git a/tests/reject/tnolen.nim b/tests/reject/tnolen.nim deleted file mode 100644 index e33086536..000000000 --- a/tests/reject/tnolen.nim +++ /dev/null @@ -1,9 +0,0 @@ -discard """ - line: 8 - msg: "type mismatch: got (int literal(3))" -""" - -# please finally disallow Len(3) - -echo len(3) - diff --git a/tests/reject/tnoop.nim b/tests/reject/tnoop.nim deleted file mode 100644 index c79403e11..000000000 --- a/tests/reject/tnoop.nim +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 1985ef666..000000000 --- a/tests/reject/tnot.nim +++ /dev/null @@ -1,21 +0,0 @@ -discard """ - file: "system.nim" - errormsg: "type mismatch" -""" -# BUG: following compiles, but should not: - -proc nodeOfDegree(x: Int): bool = - result = false - -proc main = - for j in 0..2: - for i in 0..10: - if not nodeOfDegree(1) >= 0: #ERROR_MSG type mismatch - Echo "Yes" - else: - Echo "No" - -main() - - - diff --git a/tests/reject/trawstr.nim b/tests/reject/trawstr.nim deleted file mode 100644 index ab2aae159..000000000 --- a/tests/reject/trawstr.nim +++ /dev/null @@ -1,12 +0,0 @@ -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/tsimtych.nim b/tests/reject/tsimtych.nim deleted file mode 100644 index dd969958c..000000000 --- a/tests/reject/tsimtych.nim +++ /dev/null @@ -1,12 +0,0 @@ -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/run/globalaux.nim b/tests/run/globalaux.nim deleted file mode 100644 index 5f6f72721..000000000 --- a/tests/run/globalaux.nim +++ /dev/null @@ -1,15 +0,0 @@ -type - TObj*[T] = object - val*: T - -var - totalGlobals* = 0 - -proc makeObj[T](x: T): TObj[T] = - totalGlobals += 1 - result.val = x - -proc globalInstance*[T]: var TObj[T] = - var g {.global.} = when T is int: makeObj(10) else: makeObj("hello") - result = g - diff --git a/tests/run/globalaux2.nim b/tests/run/globalaux2.nim deleted file mode 100644 index 6c77f1f48..000000000 --- a/tests/run/globalaux2.nim +++ /dev/null @@ -1,4 +0,0 @@ -import globalaux - -echo "in globalaux2: ", globalInstance[int]().val - diff --git a/tests/run/minit.nim b/tests/run/minit.nim deleted file mode 100644 index 75fcebb77..000000000 --- a/tests/run/minit.nim +++ /dev/null @@ -1,2 +0,0 @@ -# Test the new initialization for modules -write(stdout, "Hello from module! ") diff --git a/tests/run/tack.nim b/tests/run/tack.nim deleted file mode 100644 index 680ff567e..000000000 --- a/tests/run/tack.nim +++ /dev/null @@ -1,21 +0,0 @@ -discard """ - file: "tack.nim" - output: "125" -""" -# the Ackermann function - -proc ack(x, y: int): int = - if x != 0: - if y != 0: - return ack(x-1, ack(x, y-1)) - return ack(x-1, 1) - else: - return y + 1 -# if x == 0: return y + 1 -# elif y == 0: return ack(x-1, 1) -# else: return ack(x-1, ack(x, y-1)) - -# echo(ack(0, 0)) -write(stdout, ack(3, 4)) #OUT 125 - - diff --git a/tests/run/tbug511622.nim b/tests/run/tbug511622.nim deleted file mode 100644 index a5360423d..000000000 --- a/tests/run/tbug511622.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - file: "tbug511622.nim" - output: "3" -""" -import StrUtils, Math - -proc FibonacciA(n: int): int64 = - var fn = float64(n) - var p: float64 = (1.0 + sqrt(5.0)) / 2.0 - var q: float64 = 1.0 / p - return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0)) - -echo FibonacciA(4) #OUT 3 - - - diff --git a/tests/run/tdestructor.nim b/tests/run/tdestructor.nim deleted file mode 100644 index 8aae2fce2..000000000 --- a/tests/run/tdestructor.nim +++ /dev/null @@ -1,26 +0,0 @@ -discard """ - output: '''some text -Destructor called!''' -""" - -type - TMyObj = object - x, y: int - p: pointer - -proc destruct(o: var TMyObj) {.destructor.} = - if o.p != nil: dealloc o.p - echo "Destructor called!" - -proc open: TMyObj = - # allow for superfluous () - result = (TMyObj(x: 1, y: 2, p: alloc(3))) - - -proc `$`(x: TMyObj): string = $x.y - -proc main() = - var x = open() - echo "some text" - -main() diff --git a/tests/run/temit.nim b/tests/run/temit.nim deleted file mode 100644 index ff8df0585..000000000 --- a/tests/run/temit.nim +++ /dev/null @@ -1,20 +0,0 @@ -discard """ - file: "temit.nim" - output: "509" -""" -# Test the new ``emit`` pragma: - -{.emit: """ -static int cvariable = 420; - -""".} - -proc embedsC() = - var nimrodVar = 89 - {.emit: """printf("%d\n", cvariable + (int)`nimrodVar`);""".} - -embedsC() - - - - diff --git a/tests/run/teventemitter.nim b/tests/run/teventemitter.nim deleted file mode 100644 index 9ecf72ea2..000000000 --- a/tests/run/teventemitter.nim +++ /dev/null @@ -1,33 +0,0 @@ -discard """ - output: "pie" -""" - -import tables, lists - -type - TEventArgs = object of TObject - TEventEmitter = object of TObject - events*: TTable[string, TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]] - -proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) = - for func in nodes(emitter.events[event]): - func.value(args) #call function with args. - -proc on*(emitter: var TEventEmitter, event: string, - func: proc(e: TEventArgs) {.nimcall.}) = - if not hasKey(emitter.events, event): - var list: TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}] - add(emitter.events, event, list) #if not, add it. - append(emitter.events.mget(event), func) - -proc initEmitter(emitter: var TEventEmitter) = - emitter.events = initTable[string, - TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]]() - -var - ee: TEventEmitter - args: TEventArgs -initEmitter(ee) -ee.on("print", proc(e: TEventArgs) = echo("pie")) -ee.emit("print", args) - diff --git a/tests/run/tevents.nim b/tests/run/tevents.nim deleted file mode 100644 index fb94b1f79..000000000 --- a/tests/run/tevents.nim +++ /dev/null @@ -1,48 +0,0 @@ -discard """ -file: "tevents.nim" -output: '''HandlePrintEvent: Output -> Handled print event -HandlePrintEvent2: Output -> printing for ME -HandlePrintEvent2: Output -> printing for ME''' -""" - -import events - -type - TPrintEventArgs = object of TEventArgs - user*: string - -proc handleprintevent*(e: TEventArgs) = - write(stdout, "HandlePrintEvent: Output -> Handled print event\n") - -proc handleprintevent2*(e: TEventArgs) = - var args: TPrintEventArgs = TPrintEventArgs(e) - write(stdout, "HandlePrintEvent2: Output -> printing for " & args.user) - -var ee = initEventEmitter() - -var eventargs: TPrintEventArgs -eventargs.user = "ME\n" - -##method one test - -ee.on("print", handleprintevent) -ee.on("print", handleprintevent2) - -ee.emit("print", eventargs) - -##method two test - -type - TSomeObject = object of TObject - PrintEvent: TEventHandler - -var obj: TSomeObject -obj.PrintEvent = initEventHandler("print") -obj.PrintEvent.addHandler(handleprintevent2) - -ee.emit(obj.PrintEvent, eventargs) - -obj.PrintEvent.removeHandler(handleprintevent2) - -ee.emit(obj.PrintEvent, eventargs) - diff --git a/tests/run/tfilter.nim b/tests/run/tfilter.nim deleted file mode 100644 index 5846d0efb..000000000 --- a/tests/run/tfilter.nim +++ /dev/null @@ -1,41 +0,0 @@ -discard """ - output: "02468101214161820\n15" -""" - -proc filter[T](list: seq[T], f: proc (item: T): bool {.closure.}): seq[T] = - result = @[] - for i in items(list): - if f(i): - result.add(i) - -let nums = @[0, 1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] - -when true: - let nums2 = filter(nums, - (proc (item: int): bool = - result = (item mod 2) == 0) - ) - -proc outer = - # lets use a proper closure this time: - var modulo = 2 - let nums2 = filter(nums, - (proc (item: int): bool = result = (item mod modulo) == 0) - ) - - for n in nums2: stdout.write(n) - stdout.write("\n") - -outer() - -import math -proc compose[T](f1, f2: proc (x: T): T {.closure.}): proc (x: T): T {.closure.} = - result = (proc (x: T): T = - result = f1(f2(x))) - - -proc add5(x: int): int = result = x + 5 - -var test = compose(add5, add5) -echo test(5) - diff --git a/tests/run/thintoff.nim b/tests/run/thintoff.nim deleted file mode 100644 index 807ff44f3..000000000 --- a/tests/run/thintoff.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "thintoff.nim" - output: "0" -""" - -{.hint[XDeclaredButNotUsed]: off.} -var - x: int - -echo x #OUT 0 - - diff --git a/tests/run/tinit.nim b/tests/run/tinit.nim deleted file mode 100644 index 5c75567ec..000000000 --- a/tests/run/tinit.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tinit.nim" - output: "Hello from module! Hello from main module!" -""" -# Test the new init section in modules - -import minit - -write(stdout, "Hello from main module!\n") -#OUT Hello from module! Hello from main module! - - diff --git a/tests/run/tints.nim b/tests/run/tints.nim deleted file mode 100644 index fb2852af9..000000000 --- a/tests/run/tints.nim +++ /dev/null @@ -1,45 +0,0 @@ -discard """ - file: "tints.nim" - output: "Success" -""" -# Test the different integer operations - -var testNumber = 0 - -template test(opr, a, b, c: expr): stmt {.immediate.} = - # test the expression at compile and runtime - block: - const constExpr = opr(a, b) - when constExpr != c: - {.error: "Test failed " & $constExpr & " " & $c.} - inc(testNumber) - #Echo("Test: " & $testNumber) - var aa = a - var bb = b - var varExpr = opr(aa, bb) - assert(varExpr == c) - -test(`+`, 12'i8, -13'i16, -1'i16) -test(`shl`, 0b11, 0b100, 0b110000) -test(`shl`, 0b11'i32, 0b100'i64, 0b110000'i64) -test(`shl`, 0b11'i32, 0b100'i32, 0b110000'i32) - -test(`or`, 0xf0f0'i16, 0x0d0d'i16, 0xfdfd'i16) -test(`and`, 0xf0f0'i16, 0xfdfd'i16, 0xf0f0'i16) - -test(`shr`, 0xffffffffffffffff'i64, 0x4'i64, 0x0fffffffffffffff'i64) -test(`shr`, 0xffff'i16, 0x4'i16, 0x0fff'i16) -test(`shr`, 0xff'i8, 0x4'i8, 0x0f'i8) - -test(`shr`, 0xffffffff'i64, 0x4'i64, 0x0fffffff'i64) -test(`shr`, 0xffffffff'i32, 0x4'i32, 0x0fffffff'i32) - -test(`shl`, 0xffffffffffffffff'i64, 0x4'i64, 0xfffffffffffffff0'i64) -test(`shl`, 0xffff'i16, 0x4'i16, 0xfff0'i16) -test(`shl`, 0xff'i8, 0x4'i8, 0xf0'i8) - -test(`shl`, 0xffffffff'i64, 0x4'i64, 0xffffffff0'i64) -test(`shl`, 0xffffffff'i32, 0x4'i32, 0xfffffff0'i32) - -Echo("Success") #OUT Success - diff --git a/tests/run/tlocals.nim b/tests/run/tlocals.nim deleted file mode 100644 index 94a34139b..000000000 --- a/tests/run/tlocals.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ - output: "(x: string here, a: 1, b: 3)" -""" - -proc simple[T](a, b: T) = - var - x = "string here" - echo locals() - -simple(1, 3) - diff --git a/tests/run/tmemoization.nim b/tests/run/tmemoization.nim deleted file mode 100644 index 78f0515f3..000000000 --- a/tests/run/tmemoization.nim +++ /dev/null @@ -1,17 +0,0 @@ -discard """ - msg: "test 1\ntest 2" - output: "TEST 1\nTEST 2\nTEST 2" -""" - -import strutils - -proc foo(s: expr[string]): string = - static: echo s - - const R = s.toUpper - return R - -echo foo("test 1") -echo foo("test 2") -echo foo("test " & $2) - diff --git a/tests/run/tnewderef.nim b/tests/run/tnewderef.nim deleted file mode 100644 index 89dc4c8d1..000000000 --- a/tests/run/tnewderef.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ - output: 3 - -""" - -var x: ref int -new(x) -x[] = 3 - -echo x[] - diff --git a/tests/run/tpos.nim b/tests/run/tpos.nim deleted file mode 100644 index 3d72536dd..000000000 --- a/tests/run/tpos.nim +++ /dev/null @@ -1,35 +0,0 @@ -discard """ - file: "tpos.nim" - output: "6" -""" -# test this particular function - -proc mypos(sub, s: string, start: int = 0): int = - var - i, j, M, N: int - M = sub.len - N = s.len - i = start - j = 0 - if i >= N: - result = -1 - else: - while True: - if s[i] == sub[j]: - Inc(i) - Inc(j) - else: - i = i - j + 1 - j = 0 - if (j >= M) or (i >= N): break - if j >= M: - result = i - M - else: - result = -1 - -var sub = "hello" -var s = "world hello" -write(stdout, mypos(sub, s)) -#OUT 6 - - diff --git a/tests/run/tromans.nim b/tests/run/tromans.nim deleted file mode 100644 index fa6a63595..000000000 --- a/tests/run/tromans.nim +++ /dev/null @@ -1,71 +0,0 @@ -discard """ - file: "tromans.nim" - output: "success" -""" -import - strutils - -## Convert an integer to a Roman numeral -# See http://en.wikipedia.org/wiki/Roman_numerals for reference - -proc raiseInvalidValue(msg: string) {.noreturn.} = - # Yes, we really need a shorthand for this code... - var e: ref EInvalidValue - new(e) - e.msg = msg - raise e - -# I should use a class, perhaps. -# --> No. Why introduce additional state into such a simple and nice -# interface? State is evil. :D - -proc RomanToDecimal(romanVal: string): int = - result = 0 - var prevVal = 0 - for i in countdown(romanVal.len - 1, 0): - var val = 0 - case romanVal[i] - of 'I', 'i': val = 1 - of 'V', 'v': val = 5 - of 'X', 'x': val = 10 - of 'L', 'l': val = 50 - of 'C', 'c': val = 100 - of 'D', 'd': val = 500 - of 'M', 'm': val = 1000 - else: raiseInvalidValue("Incorrect character in roman numeral! (" & - $romanVal[i] & ")") - if val >= prevVal: - inc(result, val) - else: - dec(result, val) - prevVal = val - -proc DecimalToRoman(decValParam: int): string = - # Apparently numbers cannot be above 4000 - # Well, they can be (using overbar or parenthesis notation) - # but I see little interest (beside coding challenge) in coding them as - # we rarely use huge Roman numeral. - const romanComposites = [ - ("M", 1000), ("CM", 900), - ("D", 500), ("CD", 400), ("C", 100), - ("XC", 90), ("L", 50), ("XL", 40), ("X", 10), ("IX", 9), - ("V", 5), ("IV", 4), ("I", 1)] - if decValParam < 1 or decValParam > 3999: - raiseInvalidValue("number not representable") - result = "" - var decVal = decValParam - for key, val in items(romanComposites): - while decVal >= val: - dec(decVal, val) - result.add(key) - -for i in 1..100: - if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG" - -for i in items([1238, 1777, 3830, 2401, 379, 33, 940, 3973]): - if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG" - -echo "success" #OUT success - - - diff --git a/tests/run/tsimplesort.nim b/tests/run/tsimplesort.nim deleted file mode 100644 index 0167ca78a..000000000 --- a/tests/run/tsimplesort.nim +++ /dev/null @@ -1,313 +0,0 @@ -discard """ - output: '''true''' -""" - -import hashes, math - - -when defined(shallowADT): - {.pragma: myShallow, shallow.} -else: - {.pragma: myShallow.} - -type - TSlotEnum = enum seEmpty, seFilled, seDeleted - TKeyValuePair[A, B] = tuple[slot: TSlotEnum, key: A, val: B] - TKeyValuePairSeq[A, B] = seq[TKeyValuePair[A, B]] - TTable* {.final, myShallow.}[A, B] = object - data: TKeyValuePairSeq[A, B] - counter: int - -proc len*[A, B](t: TTable[A, B]): int = - ## returns the number of keys in `t`. - result = t.counter - -iterator pairs*[A, B](t: TTable[A, B]): tuple[key: A, val: B] = - ## iterates over any (key, value) pair in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield (t.data[h].key, t.data[h].val) - -iterator keys*[A, B](t: TTable[A, B]): A = - ## iterates over any key in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield t.data[h].key - -iterator values*[A, B](t: TTable[A, B]): B = - ## iterates over any value in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield t.data[h].val - -const - growthFactor = 2 - -proc mustRehash(length, counter: int): bool {.inline.} = - assert(length > counter) - result = (length * 2 < counter * 3) or (length - counter < 4) - -proc nextTry(h, maxHash: THash): THash {.inline.} = - result = ((5 * h) + 1) and maxHash - -template rawGetImpl() = - var h: THash = hash(key) and high(t.data) # start with real hash value - while t.data[h].slot != seEmpty: - if t.data[h].key == key and t.data[h].slot == seFilled: - return h - h = nextTry(h, high(t.data)) - result = -1 - -template rawInsertImpl() = - var h: THash = hash(key) and high(data) - while data[h].slot == seFilled: - h = nextTry(h, high(data)) - data[h].key = key - data[h].val = val - data[h].slot = seFilled - -proc RawGet[A, B](t: TTable[A, B], key: A): int = - rawGetImpl() - -proc `[]`*[A, B](t: TTable[A, B], key: A): B = - ## retrieves the value at ``t[key]``. If `key` is not in `t`, - ## default empty value for the type `B` is returned - ## and no exception is raised. One can check with ``hasKey`` whether the key - ## exists. - var index = RawGet(t, key) - if index >= 0: result = t.data[index].val - -proc hasKey*[A, B](t: TTable[A, B], key: A): bool = - ## returns true iff `key` is in the table `t`. - result = rawGet(t, key) >= 0 - -proc RawInsert[A, B](t: var TTable[A, B], data: var TKeyValuePairSeq[A, B], - key: A, val: B) = - rawInsertImpl() - -proc Enlarge[A, B](t: var TTable[A, B]) = - var n: TKeyValuePairSeq[A, B] - newSeq(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): - if t.data[i].slot == seFilled: RawInsert(t, n, t.data[i].key, t.data[i].val) - swap(t.data, n) - -template PutImpl() = - var index = RawGet(t, key) - if index >= 0: - t.data[index].val = val - else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) - inc(t.counter) - -proc `[]=`*[A, B](t: var TTable[A, B], key: A, val: B) = - ## puts a (key, value)-pair into `t`. - putImpl() - -proc del*[A, B](t: var TTable[A, B], key: A) = - ## deletes `key` from hash table `t`. - var index = RawGet(t, key) - if index >= 0: - t.data[index].slot = seDeleted - dec(t.counter) - -proc initTable*[A, B](initialSize=64): TTable[A, B] = - ## creates a new hash table that is empty. `initialSize` needs to be - ## a power of two. - assert isPowerOfTwo(initialSize) - result.counter = 0 - newSeq(result.data, initialSize) - -proc toTable*[A, B](pairs: openarray[tuple[key: A, - val: B]]): TTable[A, B] = - ## creates a new hash table that contains the given `pairs`. - result = initTable[A, B](nextPowerOfTwo(pairs.len+10)) - for key, val in items(pairs): result[key] = val - -template dollarImpl(): stmt = - if t.len == 0: - result = "{:}" - else: - result = "{" - for key, val in pairs(t): - if result.len > 1: result.add(", ") - result.add($key) - result.add(": ") - result.add($val) - result.add("}") - -proc `$`*[A, B](t: TTable[A, B]): string = - ## The `$` operator for hash tables. - dollarImpl() - -# ------------------------------ count tables ------------------------------- - -type - TCountTable* {.final, myShallow.}[ - A] = object ## table that counts the number of each key - data: seq[tuple[key: A, val: int]] - counter: int - -proc len*[A](t: TCountTable[A]): int = - ## returns the number of keys in `t`. - result = t.counter - -iterator pairs*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## iterates over any (key, value) pair in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield (t.data[h].key, t.data[h].val) - -iterator keys*[A](t: TCountTable[A]): A = - ## iterates over any key in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield t.data[h].key - -iterator values*[A](t: TCountTable[A]): int = - ## iterates over any value in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield t.data[h].val - -proc RawGet[A](t: TCountTable[A], key: A): int = - var h: THash = hash(key) and high(t.data) # start with real hash value - while t.data[h].val != 0: - if t.data[h].key == key: return h - h = nextTry(h, high(t.data)) - result = -1 - -proc `[]`*[A](t: TCountTable[A], key: A): int = - ## retrieves the value at ``t[key]``. If `key` is not in `t`, - ## 0 is returned. One can check with ``hasKey`` whether the key - ## exists. - var index = RawGet(t, key) - if index >= 0: result = t.data[index].val - -proc hasKey*[A](t: TCountTable[A], key: A): bool = - ## returns true iff `key` is in the table `t`. - result = rawGet(t, key) >= 0 - -proc RawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]], - key: A, val: int) = - var h: THash = hash(key) and high(data) - while data[h].val != 0: h = nextTry(h, high(data)) - data[h].key = key - data[h].val = val - -proc Enlarge[A](t: var TCountTable[A]) = - var n: seq[tuple[key: A, val: int]] - newSeq(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): - if t.data[i].val != 0: RawInsert(t, n, t.data[i].key, t.data[i].val) - swap(t.data, n) - -proc `[]=`*[A](t: var TCountTable[A], key: A, val: int) = - ## puts a (key, value)-pair into `t`. `val` has to be positive. - assert val > 0 - PutImpl() - -proc initCountTable*[A](initialSize=64): TCountTable[A] = - ## creates a new count table that is empty. `initialSize` needs to be - ## a power of two. - assert isPowerOfTwo(initialSize) - result.counter = 0 - newSeq(result.data, initialSize) - -proc toCountTable*[A](keys: openArray[A]): TCountTable[A] = - ## creates a new count table with every key in `keys` having a count of 1. - result = initCountTable[A](nextPowerOfTwo(keys.len+10)) - for key in items(keys): result[key] = 1 - -proc `$`*[A](t: TCountTable[A]): string = - ## The `$` operator for count tables. - dollarImpl() - -proc inc*[A](t: var TCountTable[A], key: A, val = 1) = - ## increments `t[key]` by `val`. - var index = RawGet(t, key) - if index >= 0: - inc(t.data[index].val, val) - else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) - inc(t.counter) - -proc Smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## returns the largest (key,val)-pair. Efficiency: O(n) - assert t.len > 0 - var minIdx = 0 - for h in 1..high(t.data): - if t.data[h].val > 0 and t.data[minIdx].val > t.data[h].val: minIdx = h - result.key = t.data[minIdx].key - result.val = t.data[minIdx].val - -proc Largest*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## returns the (key,val)-pair with the largest `val`. Efficiency: O(n) - assert t.len > 0 - var maxIdx = 0 - for h in 1..high(t.data): - if t.data[maxIdx].val < t.data[h].val: maxIdx = h - result.key = t.data[maxIdx].key - result.val = t.data[maxIdx].val - -proc sort*[A](t: var TCountTable[A]) = - ## sorts the count table so that the entry with the highest counter comes - ## first. This is destructive! You must not modify `t` afterwards! - ## You can use the iterators `pairs`, `keys`, and `values` to iterate over - ## `t` in the sorted order. - - # we use shellsort here; fast enough and simple - var h = 1 - while true: - h = 3 * h + 1 - if h >= high(t.data): break - while true: - h = h div 3 - for i in countup(h, high(t.data)): - var j = i - while t.data[j-h].val <= t.data[j].val: - var xyz = t.data[j] - t.data[j] = t.data[j-h] - t.data[j-h] = xyz - j = j-h - if j < h: break - if h == 1: break - - -const - data = { - "34": 123456, "12": 789, - "90": 343, "0": 34404, - "1": 344004, "2": 344774, - "3": 342244, "4": 3412344, - "5": 341232144, "6": 34214544, - "7": 3434544, "8": 344544, - "9": 34435644, "---00": 346677844, - "10": 34484, "11": 34474, "19": 34464, - "20": 34454, "30": 34141244, "40": 344114, - "50": 344490, "60": 344491, "70": 344492, - "80": 344497} - -proc countTableTest1 = - var s = initTable[string, int](64) - for key, val in items(data): s[key] = val - var w: tuple[key: string, val: int] #type(otherCountTable.data[0]) - - var t = initCountTable[string]() - for k, v in items(data): t.inc(k) - for k in t.keys: assert t[k] == 1 - t.inc("90", 3) - t.inc("12", 2) - t.inc("34", 1) - assert t.largest()[0] == "90" - t.sort() - - var i = 0 - for k, v in t.pairs: - case i - of 0: assert k == "90" and v == 4 - of 1: assert k == "12" and v == 3 - of 2: assert k == "34" and v == 2 - else: break - inc i - -countTableTest1() -echo true - - diff --git a/tests/run/tslices.nim b/tests/run/tslices.nim deleted file mode 100644 index 0de1171e3..000000000 --- a/tests/run/tslices.nim +++ /dev/null @@ -1,59 +0,0 @@ -discard """ - file: "tslices.nim" - output: '''456456 -456456 -456456 -Zugr5nd -egerichtetd -verichtetd -''' -""" - -# Test the new slices. - -import strutils - -var mystr = "Abgrund" -mystr[..1] = "Zu" - -mystr[4..4] = "5" - -type - TEnum = enum e1, e2, e3, e4, e5, e6 - -var myarr: array[TEnum, int] = [1, 2, 3, 4, 5, 6] -myarr[e1..e3] = myarr[e4..e6] -myarr[..e3] = myarr[e4..e6] - -for x in items(myarr): stdout.write(x) -echo() - -var myarr2: array[0..5, int] = [1, 2, 3, 4, 5, 6] -myarr2[0..2] = myarr2[3..5] - -for x in items(myarr2): stdout.write(x) -echo() - - -var myseq = @[1, 2, 3, 4, 5, 6] -myseq[0..2] = myseq[-3.. -1] - -for x in items(myseq): stdout.write(x) -echo() - -echo mystr - -mystr[4..4] = "u" - -# test full replacement -mystr[.. -2] = "egerichtet" - -echo mystr - -mystr[0..2] = "ve" -echo mystr - -var s = "abcdef" -s[1 .. -2] = "xyz" -assert s == "axyzf" - diff --git a/tests/run/tsortdev.nim b/tests/run/tsortdev.nim deleted file mode 100644 index d7d42d22c..000000000 --- a/tests/run/tsortdev.nim +++ /dev/null @@ -1,59 +0,0 @@ -discard """ - output: "done" -""" - -import algorithm, strutils - -proc cmpPlatforms(a, b: string): int = - if a == b: return 0 - var dashes = a.split('-') - var dashes2 = b.split('-') - if dashes[0] == dashes2[0]: - if dashes[1] == dashes2[1]: return system.cmp(a,b) - case dashes[1] - of "x86": - return 1 - of "x86_64": - if dashes2[1] == "x86": return -1 - else: return 1 - of "ppc64": - if dashes2[1] == "x86" or dashes2[1] == "x86_64": return -1 - else: return 1 - else: - return system.cmp(dashes[1], dashes2[1]) - else: - case dashes[0] - of "linux": - return 1 - of "windows": - if dashes2[0] == "linux": return -1 - else: return 1 - of "macosx": - if dashes2[0] == "linux" or dashes2[0] == "windows": return -1 - else: return 1 - else: - if dashes2[0] == "linux" or dashes2[0] == "windows" or - dashes2[0] == "macosx": return -1 - else: - return system.cmp(a, b) - -proc sorted[T](a: openArray[T]): bool = - result = true - for i in 0 .. < a.high: - if cmpPlatforms(a[i], a[i+1]) > 0: - echo "Out of order: ", a[i], " ", a[i+1] - result = false - -proc main() = - var testData = @["netbsd-x86_64", "windows-x86", "linux-x86_64", "linux-x86", - "linux-ppc64", "macosx-x86-1058", "macosx-x86-1068"] - - sort(testData, cmpPlatforms) - - doAssert sorted(testData) - -for i in 0..1_000: - main() - -echo "done" - diff --git a/tests/run/tstrange.nim b/tests/run/tstrange.nim deleted file mode 100644 index 3947755fc..000000000 --- a/tests/run/tstrange.nim +++ /dev/null @@ -1,23 +0,0 @@ -discard """ - file: "tstrange.nim" - output: "hallo4" -""" -# test for extremely strange bug - -proc ack(x: int, y: int): int = - if x != 0: - if y != 5: - return y - return x - return x+y - -proc gen[T](a: T) = - write(stdout, a) - - -gen("hallo") -write(stdout, ack(5, 4)) -#OUT hallo4 - - - diff --git a/tests/run/tunittests.nim b/tests/run/tunittests.nim deleted file mode 100644 index c77f691d9..000000000 --- a/tests/run/tunittests.nim +++ /dev/null @@ -1 +0,0 @@ -import utemplates, uclosures diff --git a/tests/run/tvarious1.nim b/tests/run/tvarious1.nim deleted file mode 100644 index 6e4612ae3..000000000 --- a/tests/run/tvarious1.nim +++ /dev/null @@ -1,41 +0,0 @@ -discard """ - file: "tlenopenarray.nim" - output: '''1 -0 -Whopie -12''' -""" - -echo len([1_000_000]) #OUT 1 - -type - TArray = array[0..3, int] - TVector = distinct array[0..3, int] -proc `[]`(v: TVector; idx: int): int = TArray(v)[idx] -var v: TVector -echo v[2] - -# bug #569 - -import queues - -type - TWidget = object - names: TQueue[string] - -var w = TWidget(names: initQueue[string]()) - -add(w.names, "Whopie") - -for n in w.names: echo(n) - -# bug #681 - -type TSomeRange = object - hour: range[0..23] - -var value: string -var val12 = TSomeRange(hour: 12) - -value = $(if val12.hour > 12: val12.hour - 12 else: val12.hour) -echo value diff --git a/tests/run/tvarnums.nim b/tests/run/tvarnums.nim deleted file mode 100644 index 4f99df8b9..000000000 --- a/tests/run/tvarnums.nim +++ /dev/null @@ -1,142 +0,0 @@ -discard """ - file: "tvarnums.nim" - output: "Success!" -""" -# Test variable length binary integers - -import - strutils - -type - TBuffer = array [0..10, int8] - -proc toVarNum(x: int32, b: var TBuffer) = - # encoding: first bit indicates end of number (0 if at end) - # second bit of the first byte denotes the sign (1 --> negative) - var a = x - if x != low(x): - # low(int) is a special case, - # because abs() does not work here! - # we leave x as it is and use the check >% instead of > - # for low(int) this is needed and positive numbers are not affected - # anyway - a = abs(x) - # first 6 bits: - b[0] = toU8(ord(a >% 63'i32) shl 7 or (ord(x < 0'i32) shl 6) or (int(a) and 63)) - a = a shr 6'i32 # skip first 6 bits - var i = 1 - while a != 0'i32: - b[i] = toU8(ord(a >% 127'i32) shl 7 or (int(a) and 127)) - inc(i) - a = a shr 7'i32 - -proc toVarNum64(x: int64, b: var TBuffer) = - # encoding: first bit indicates end of number (0 if at end) - # second bit of the first byte denotes the sign (1 --> negative) - var a = x - if x != low(x): - # low(int) is a special case, - # because abs() does not work here! - # we leave x as it is and use the check >% instead of > - # for low(int) this is needed and positive numbers are not affected - # anyway - a = abs(x) - # first 6 bits: - b[0] = toU8(ord(a >% 63'i64) shl 7 or (ord(x < 0'i64) shl 6) or int(a and 63)) - a = a shr 6 # skip first 6 bits - var i = 1 - while a != 0'i64: - b[i] = toU8(ord(a >% 127'i64) shl 7 or int(a and 127)) - inc(i) - a = a shr 7 - -proc toNum64(b: TBuffer): int64 = - # treat first byte different: - result = ze64(b[0]) and 63 - var - i = 0 - Shift = 6'i64 - while (ze(b[i]) and 128) != 0: - inc(i) - result = result or ((ze64(b[i]) and 127) shl Shift) - inc(Shift, 7) - if (ze(b[0]) and 64) != 0: # sign bit set? - result = not result +% 1 - # this is the same as ``- result`` - # but gives no overflow error for low(int) - -proc toNum(b: TBuffer): int32 = - # treat first byte different: - result = ze(b[0]) and 63 - var - i = 0 - Shift = 6'i32 - while (ze(b[i]) and 128) != 0: - inc(i) - result = result or ((int32(ze(b[i])) and 127'i32) shl Shift) - Shift = shift + 7'i32 - if (ze(b[0]) and (1 shl 6)) != 0: # sign bit set? - result = (not result) +% 1'i32 - # this is the same as ``- result`` - # but gives no overflow error for low(int) - -proc toBinary(x: int64): string = - result = newString(64) - for i in 0..63: - result[63-i] = chr((int(x shr i) and 1) + ord('0')) - -proc t64(i: int64) = - var - b: TBuffer - toVarNum64(i, b) - var x = toNum64(b) - if x != i: - writeln(stdout, $i) - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -proc t32(i: int32) = - var - b: TBuffer - toVarNum(i, b) - var x = toNum(b) - if x != i: - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -proc tm(i: int32) = - var - b: TBuffer - toVarNum64(i, b) - var x = toNum(b) - if x != i: - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -t32(0) -t32(1) -t32(-1) -t32(-100_000) -t32(100_000) -t32(low(int32)) -t32(high(int32)) - -t64(low(int64)) -t64(high(int64)) -t64(0) -t64(-1) -t64(1) -t64(1000_000) -t64(-1000_000) - -tm(0) -tm(1) -tm(-1) -tm(-100_000) -tm(100_000) -tm(low(int32)) -tm(high(int32)) - -writeln(stdout, "Success!") #OUT Success! - - diff --git a/tests/compile/tseq2.nim b/tests/seq/tseq2.nim index e1271964c..e1271964c 100644 --- a/tests/compile/tseq2.nim +++ b/tests/seq/tseq2.nim diff --git a/tests/run/tseqcon.nim b/tests/seq/tseqcon.nim index 6e0a5b56d..6e0a5b56d 100644 --- a/tests/run/tseqcon.nim +++ b/tests/seq/tseqcon.nim diff --git a/tests/compile/tseqcon2.nim b/tests/seq/tseqcon2.nim index 4f2763ffe..4f2763ffe 100644 --- a/tests/compile/tseqcon2.nim +++ b/tests/seq/tseqcon2.nim diff --git a/tests/run/tseqtuple.nim b/tests/seq/tseqtuple.nim index 7ef92f7f1..7ef92f7f1 100644 --- a/tests/run/tseqtuple.nim +++ b/tests/seq/tseqtuple.nim diff --git a/tests/run/tsequtils.nim b/tests/seq/tsequtils.nim index 7bc15ef9c..7bc15ef9c 100644 --- a/tests/run/tsequtils.nim +++ b/tests/seq/tsequtils.nim diff --git a/tests/run/ttoseq.nim b/tests/seq/ttoseq.nim index 34cc4824b..34cc4824b 100644 --- a/tests/run/ttoseq.nim +++ b/tests/seq/ttoseq.nim diff --git a/tests/run/tsets.nim b/tests/sets/tsets.nim index 7b806f15b..7b806f15b 100644 --- a/tests/run/tsets.nim +++ b/tests/sets/tsets.nim diff --git a/tests/run/tsets2.nim b/tests/sets/tsets2.nim index ac977096b..ac977096b 100644 --- a/tests/run/tsets2.nim +++ b/tests/sets/tsets2.nim diff --git a/tests/run/tdrdobbs_examples.nim b/tests/showoff/tdrdobbs_examples.nim index d1e0585d2..d1e0585d2 100644 --- a/tests/run/tdrdobbs_examples.nim +++ b/tests/showoff/tdrdobbs_examples.nim diff --git a/tests/showoff/tformatopt.nim b/tests/showoff/tformatopt.nim new file mode 100644 index 000000000..f33ed6921 --- /dev/null +++ b/tests/showoff/tformatopt.nim @@ -0,0 +1,57 @@ +discard """ + output: '''(a: 3 +b: 4 +s: abc +)''' +""" + +import macros + +proc invalidFormatString() = + echo "invalidFormatString" + +template formatImpl(handleChar: expr) = + var i = 0 + while i < f.len: + if f[i] == '$': + case f[i+1] + of '1'..'9': + var j = 0 + i += 1 + while f[i] in {'0'..'9'}: + j = j * 10 + ord(f[i]) - ord('0') + i += 1 + result.add(a[j-1]) + else: + invalidFormatString() + else: + result.add(handleChar(f[i])) + i += 1 + +proc `%`*(f: string, a: openArray[string]): string = + template identity(x: expr): expr = x + result = "" + formatImpl(identity) + +macro optFormat{`%`(f, a)}(f: string{lit}, a: openArray[string]): expr = + result = newNimNode(nnkBracket) + let f = f.strVal + formatImpl(newLit) + result = nestList(!"&", result) + +template optAdd1{x = y; add(x, z)}(x, y, z: string) = + x = y & z + +proc `/&` [T: object](x: T): string = + result = "(" + for name, value in fieldPairs(x): + result.add("$1: $2\n" % [name, $value]) + result.add(")") + +type + MyObject = object + a, b: int + s: string + +let obj = MyObject(a: 3, b: 4, s: "abc") +echo(/&obj) diff --git a/tests/showoff/thello2.nim b/tests/showoff/thello2.nim new file mode 100644 index 000000000..d2e2f6227 --- /dev/null +++ b/tests/showoff/thello2.nim @@ -0,0 +1,11 @@ +discard """ + output: '''(a: 3, b: 4, s: abc)''' +""" + +type + MyObject = object + a, b: int + s: string + +let obj = MyObject(a: 3, b: 4, s: "abc") +echo obj diff --git a/tests/showoff/thtml1.nim b/tests/showoff/thtml1.nim new file mode 100644 index 000000000..cd95c7971 --- /dev/null +++ b/tests/showoff/thtml1.nim @@ -0,0 +1,11 @@ +discard """ + output: "<br>" +""" + +template htmlTag(tag: expr) {.immediate.} = + proc tag(): string = "<" & astToStr(tag) & ">" + +htmlTag(br) +htmlTag(html) + +echo br() diff --git a/tests/showoff/thtml2.nim b/tests/showoff/thtml2.nim new file mode 100644 index 000000000..8a451ebf1 --- /dev/null +++ b/tests/showoff/thtml2.nim @@ -0,0 +1,37 @@ +discard """ + output: "<html><head><title>now look at this</title></head><body><ul><li>Nimrod is quite capable</li></ul></body></html>" +""" + +import strutils + +template html(name: expr, matter: stmt) {.immediate.} = + proc name(): string = + result = "<html>" + matter + result.add("</html>") + +template nestedTag(tag: expr) {.immediate.} = + template tag(matter: stmt) {.immediate.} = + result.add("<" & astToStr(tag) & ">") + matter + result.add("</" & astToStr(tag) & ">") + +template simpleTag(tag: expr) {.immediate.} = + template tag(matter: expr) {.immediate.} = + result.add("<$1>$2</$1>" % [astToStr(tag), matter]) + +nestedTag body +nestedTag head +nestedTag ul +simpleTag title +simpleTag li + + +html mainPage: + head: + title "now look at this" + body: + ul: + li "Nimrod is quite capable" + +echo mainPage() diff --git a/tests/showoff/tonce.nim b/tests/showoff/tonce.nim new file mode 100644 index 000000000..6fc372e87 --- /dev/null +++ b/tests/showoff/tonce.nim @@ -0,0 +1,22 @@ +discard """ + output: '''first call of p +some call of p +new instantiation +some call of p''' +""" + +template once(body: stmt) = + var x {.global.} = false + if not x: + x = true + body + +proc p() = + once: + echo "first call of p" + echo "some call of p" + +p() +once: + echo "new instantiation" +p() diff --git a/tests/showoff/tquasiquote.nim b/tests/showoff/tquasiquote.nim new file mode 100644 index 000000000..df7fccc33 --- /dev/null +++ b/tests/showoff/tquasiquote.nim @@ -0,0 +1,14 @@ +discard """ + outputsub: '''tquasiquote.nim(14,8): Check failed: 1 > 2''' +""" + +import macros + +macro check(ex: expr): stmt = + var info = ex.lineInfo + var expString = ex.toStrLit + result = quote do: + if not `ex`: + echo `info`, ": Check failed: ", `expString` + +check 1 > 2 diff --git a/tests/compile/tcputime.nim b/tests/stdlib/tcputime.nim index 2fc46ee64..2fc46ee64 100644 --- a/tests/compile/tcputime.nim +++ b/tests/stdlib/tcputime.nim diff --git a/tests/run/tcritbits.nim b/tests/stdlib/tcritbits.nim index fb447b80b..fb447b80b 100644 --- a/tests/run/tcritbits.nim +++ b/tests/stdlib/tcritbits.nim diff --git a/tests/compile/tdialogs.nim b/tests/stdlib/tdialogs.nim index d161a976d..d161a976d 100644 --- a/tests/compile/tdialogs.nim +++ b/tests/stdlib/tdialogs.nim diff --git a/tests/compile/techo.nim b/tests/stdlib/techo.nim index 0fa4b5fe0..0fa4b5fe0 100644 --- a/tests/compile/techo.nim +++ b/tests/stdlib/techo.nim diff --git a/tests/run/tformat.nim b/tests/stdlib/tformat.nim index 92c0c16f5..92c0c16f5 100644 --- a/tests/run/tformat.nim +++ b/tests/stdlib/tformat.nim diff --git a/tests/run/thashes.nim b/tests/stdlib/thashes.nim index c442b43fb..c442b43fb 100644 --- a/tests/run/thashes.nim +++ b/tests/stdlib/thashes.nim diff --git a/tests/compile/tio.nim b/tests/stdlib/tio.nim index 5ae119f77..5ae119f77 100644 --- a/tests/compile/tio.nim +++ b/tests/stdlib/tio.nim diff --git a/tests/compile/tircbot.nim b/tests/stdlib/tircbot.nim index d16c99b69..6008838ff 100644 --- a/tests/compile/tircbot.nim +++ b/tests/stdlib/tircbot.nim @@ -257,7 +257,7 @@ proc limitCommitMsg(m: string): string = proc handleWebMessage(state: PState, line: string) = echo("Got message from hub: " & line) var json = parseJson(line) - if json.existsKey("payload"): + if json.hasKey("payload"): for i in 0..min(4, json["payload"]["commits"].len-1): var commit = json["payload"]["commits"][i] # Create the message @@ -273,8 +273,8 @@ proc handleWebMessage(state: PState, line: string) = # Send message to #nimrod. state.ircClient.privmsg(joinChans[0], message) - elif json.existsKey("redisinfo"): - assert json["redisinfo"].existsKey("port") + elif json.hasKey("redisinfo"): + assert json["redisinfo"].hasKey("port") #let redisPort = json["redisinfo"]["port"].num state.dbConnected = true diff --git a/tests/run/tlists.nim b/tests/stdlib/tlists.nim index 7d5379945..7d5379945 100644 --- a/tests/run/tlists.nim +++ b/tests/stdlib/tlists.nim diff --git a/tests/compile/tmarshal.nim b/tests/stdlib/tmarshal.nim index 5471d347a..5471d347a 100644 --- a/tests/compile/tmarshal.nim +++ b/tests/stdlib/tmarshal.nim diff --git a/tests/run/tmath.nim b/tests/stdlib/tmath.nim index a86a3b84c..a86a3b84c 100644 --- a/tests/run/tmath.nim +++ b/tests/stdlib/tmath.nim diff --git a/tests/compile/tmath.nim b/tests/stdlib/tmath2.nim index 6a1dae54d..6a1dae54d 100644 --- a/tests/compile/tmath.nim +++ b/tests/stdlib/tmath2.nim diff --git a/tests/compile/tmongo.nim b/tests/stdlib/tmongo.nim index 1c4c0f4e6..1c4c0f4e6 100644 --- a/tests/compile/tmongo.nim +++ b/tests/stdlib/tmongo.nim diff --git a/tests/compile/tos.nim b/tests/stdlib/tos.nim index fa9993cc9..fa9993cc9 100644 --- a/tests/compile/tos.nim +++ b/tests/stdlib/tos.nim diff --git a/tests/compile/tparscfg.nim b/tests/stdlib/tparscfg.nim index 618ecadd6..618ecadd6 100644 --- a/tests/compile/tparscfg.nim +++ b/tests/stdlib/tparscfg.nim diff --git a/tests/compile/tparsefloat.nim b/tests/stdlib/tparsefloat.nim index 38ed2db6d..38ed2db6d 100644 --- a/tests/compile/tparsefloat.nim +++ b/tests/stdlib/tparsefloat.nim diff --git a/tests/compile/tparsopt.nim b/tests/stdlib/tparsopt.nim index 2b2da7e51..2b2da7e51 100644 --- a/tests/compile/tparsopt.nim +++ b/tests/stdlib/tparsopt.nim diff --git a/tests/run/tpegs.nim b/tests/stdlib/tpegs.nim index bdd8db0f8..bdd8db0f8 100644 --- a/tests/run/tpegs.nim +++ b/tests/stdlib/tpegs.nim diff --git a/tests/compile/tposix.nim b/tests/stdlib/tposix.nim index bf0b49586..bf0b49586 100644 --- a/tests/compile/tposix.nim +++ b/tests/stdlib/tposix.nim diff --git a/tests/compile/tquit.nim b/tests/stdlib/tquit.nim index d4dc1522d..d4dc1522d 100644 --- a/tests/compile/tquit.nim +++ b/tests/stdlib/tquit.nim diff --git a/tests/run/tregex.nim b/tests/stdlib/tregex.nim index bb4695f02..bb4695f02 100644 --- a/tests/run/tregex.nim +++ b/tests/stdlib/tregex.nim diff --git a/tests/run/treguse.nim b/tests/stdlib/treguse.nim index a610ad725..a610ad725 100644 --- a/tests/run/treguse.nim +++ b/tests/stdlib/treguse.nim diff --git a/tests/run/trepr.nim b/tests/stdlib/trepr.nim index 41c830621..41c830621 100644 --- a/tests/run/trepr.nim +++ b/tests/stdlib/trepr.nim diff --git a/tests/compile/trepr.nim b/tests/stdlib/trepr2.nim index b15081e48..b15081e48 100644 --- a/tests/compile/trepr.nim +++ b/tests/stdlib/trepr2.nim diff --git a/tests/compile/tsockets.nim b/tests/stdlib/tsockets.nim index 6078504f5..6078504f5 100644 --- a/tests/compile/tsockets.nim +++ b/tests/stdlib/tsockets.nim diff --git a/tests/compile/tsortcall.nim b/tests/stdlib/tsortcall.nim index efe1d0b8b..efe1d0b8b 100644 --- a/tests/compile/tsortcall.nim +++ b/tests/stdlib/tsortcall.nim diff --git a/tests/run/tsplit.nim b/tests/stdlib/tsplit.nim index 25bad33e2..25bad33e2 100644 --- a/tests/run/tsplit.nim +++ b/tests/stdlib/tsplit.nim diff --git a/tests/compile/tstreams.nim b/tests/stdlib/tstreams.nim index 640565a27..640565a27 100644 --- a/tests/compile/tstreams.nim +++ b/tests/stdlib/tstreams.nim diff --git a/tests/compile/tstrset.nim b/tests/stdlib/tstrset.nim index 9cdb5ed35..9cdb5ed35 100644 --- a/tests/compile/tstrset.nim +++ b/tests/stdlib/tstrset.nim diff --git a/tests/compile/tstrtabs.nim b/tests/stdlib/tstrtabs.nim index 251ec77ef..251ec77ef 100644 --- a/tests/compile/tstrtabs.nim +++ b/tests/stdlib/tstrtabs.nim diff --git a/tests/run/tstrutil.nim b/tests/stdlib/tstrutil.nim index 80c2f3870..80c2f3870 100644 --- a/tests/run/tstrutil.nim +++ b/tests/stdlib/tstrutil.nim diff --git a/tests/compile/ttime.nim b/tests/stdlib/ttime.nim index bad818816..bad818816 100644 --- a/tests/compile/ttime.nim +++ b/tests/stdlib/ttime.nim diff --git a/tests/run/tunidecode.nim b/tests/stdlib/tunidecode.nim index cb6589d60..cb6589d60 100644 --- a/tests/run/tunidecode.nim +++ b/tests/stdlib/tunidecode.nim diff --git a/tests/compile/twalker.nim b/tests/stdlib/twalker.nim index 89e6c2b9d..89e6c2b9d 100644 --- a/tests/compile/twalker.nim +++ b/tests/stdlib/twalker.nim diff --git a/tests/run/txmlgen.nim b/tests/stdlib/txmlgen.nim index 917427abc..917427abc 100644 --- a/tests/run/txmlgen.nim +++ b/tests/stdlib/txmlgen.nim diff --git a/tests/run/txmltree.nim b/tests/stdlib/txmltree.nim index 931871f15..931871f15 100644 --- a/tests/run/txmltree.nim +++ b/tests/stdlib/txmltree.nim diff --git a/tests/compile/ttableconstr.nim b/tests/table/ttableconstr.nim index c627e68e8..c627e68e8 100644 --- a/tests/compile/ttableconstr.nim +++ b/tests/table/ttableconstr.nim diff --git a/tests/run/ttables.nim b/tests/table/ttables.nim index 681ff5424..681ff5424 100644 --- a/tests/run/ttables.nim +++ b/tests/table/ttables.nim diff --git a/tests/run/ttables2.nim b/tests/table/ttables2.nim index b88c8dfbf..b88c8dfbf 100644 --- a/tests/run/ttables2.nim +++ b/tests/table/ttables2.nim diff --git a/tests/template/mcan_access_hidden_field.nim b/tests/template/mcan_access_hidden_field.nim new file mode 100644 index 000000000..bf3592701 --- /dev/null +++ b/tests/template/mcan_access_hidden_field.nim @@ -0,0 +1,9 @@ + +type + Foo* = object + fooa, foob: int + +proc createFoo*(a, b: int): Foo = Foo(fooa: a, foob: b) + +template geta*(f: Foo): expr = f.fooa + diff --git a/tests/compile/mtempl5.nim b/tests/template/mtempl5.nim index 51e8461b8..51e8461b8 100644 --- a/tests/compile/mtempl5.nim +++ b/tests/template/mtempl5.nim diff --git a/tests/template/tcan_access_hidden_field.nim b/tests/template/tcan_access_hidden_field.nim new file mode 100644 index 000000000..a6f6490cc --- /dev/null +++ b/tests/template/tcan_access_hidden_field.nim @@ -0,0 +1,9 @@ +discard """ + output: 33 +""" + +import mcan_access_hidden_field + +var myfoo = createFoo(33, 44) + +echo myfoo.geta diff --git a/tests/compile/thygienictempl.nim b/tests/template/thygienictempl.nim index 3cdbac40e..3cdbac40e 100644 --- a/tests/compile/thygienictempl.nim +++ b/tests/template/thygienictempl.nim diff --git a/tests/compile/tmodulealias.nim b/tests/template/tmodulealias.nim index a7d155e51..a7d155e51 100644 --- a/tests/compile/tmodulealias.nim +++ b/tests/template/tmodulealias.nim diff --git a/tests/run/tstempl.nim b/tests/template/tstempl.nim index 2b4a8baa0..2b4a8baa0 100644 --- a/tests/run/tstempl.nim +++ b/tests/template/tstempl.nim diff --git a/tests/compile/ttempl.nim b/tests/template/ttempl.nim index 2c4785325..2c4785325 100644 --- a/tests/compile/ttempl.nim +++ b/tests/template/ttempl.nim diff --git a/tests/reject/ttempl2.nim b/tests/template/ttempl2.nim index 142bbb8c7..142bbb8c7 100644 --- a/tests/reject/ttempl2.nim +++ b/tests/template/ttempl2.nim diff --git a/tests/compile/ttempl3.nim b/tests/template/ttempl3.nim index 361d11f6e..59be24624 100644 --- a/tests/compile/ttempl3.nim +++ b/tests/template/ttempl3.nim @@ -2,7 +2,7 @@ template withOpenFile(f: expr, filename: string, mode: TFileMode, actions: stmt): stmt {.immediate.} = block: - # test that 'f' is implicitely 'injecting': + # test that 'f' is implicitly 'injecting': var f: TFile if open(f, filename, mode): try: diff --git a/tests/compile/ttempl4.nim b/tests/template/ttempl4.nim index 26c82e471..26c82e471 100644 --- a/tests/compile/ttempl4.nim +++ b/tests/template/ttempl4.nim diff --git a/tests/compile/ttempl5.nim b/tests/template/ttempl5.nim index 85692e97b..85692e97b 100644 --- a/tests/compile/ttempl5.nim +++ b/tests/template/ttempl5.nim diff --git a/tests/compile/ttemplreturntype.nim b/tests/template/ttemplreturntype.nim index 642fa1b72..642fa1b72 100644 --- a/tests/compile/ttemplreturntype.nim +++ b/tests/template/ttemplreturntype.nim diff --git a/tests/run/utemplates.nim b/tests/template/utemplates.nim index 68fbb23a6..38ad4f515 100644 --- a/tests/run/utemplates.nim +++ b/tests/template/utemplates.nim @@ -18,7 +18,7 @@ test "previous definitions can be further overloaded or hidden in local scopes": check t("test") == "string" test "templates can be redefined multiple times": - template customAssert(cond: bool, msg: string): stmt = + template customAssert(cond: bool, msg: string): stmt {.immediate, dirty.} = if not cond: fail(msg) template assertion_failed(body: stmt) {.immediate.} = diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim new file mode 100644 index 000000000..bc1f92eba --- /dev/null +++ b/tests/testament/backend.nim @@ -0,0 +1,121 @@ +# +# +# The Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# Look at license.txt for more info. +# All rights reserved. + +import strutils, db_sqlite, os, osproc + +var db: TDbConn + +proc createDb() = + db.exec(sql""" + create table if not exists Machine( + id integer primary key, + name varchar(100) not null, + os varchar(20) not null, + cpu varchar(20) not null + );""") + + db.exec(sql""" + create table if not exists [Commit]( + id integer primary key, + hash varchar(256) not null, + branch varchar(50) not null + );""") + + db.exec(sql""" + create table if not exists TestResult( + id integer primary key, + name varchar(100) not null, + category varchar(100) not null, + target varchar(20) not null, + action varchar(10) not null, + result varchar(30) not null, + [commit] int not null, + machine int not null, + expected varchar(10000) not null, + given varchar(10000) not null, + created timestamp not null default (DATETIME('now')), + + foreign key ([commit]) references [commit](id), + foreign key (machine) references machine(id) + );""") + + #db.exec(sql""" + # --create unique index if not exists TsstNameIx on TestResult(name); + # """, []) + +type + MachineId = distinct int64 + CommitId = distinct int64 + +proc `$`(id: MachineId): string {.borrow.} +proc `$`(id: CommitId): string {.borrow.} + +var + thisMachine: MachineId + thisCommit: CommitId + +proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip + +proc getMachine: MachineId = + var name = "hostname"() + if name.len == 0: + name = when defined(posix): getenv"HOSTNAME".string + else: getenv"COMPUTERNAME".string + if name.len == 0: + quit "cannot determine the machine name" + + let id = db.getValue(sql"select id from Machine where name = ?", name) + if id.len > 0: + result = id.parseInt.MachineId + else: + result = db.insertId(sql"insert into Machine(name, os, cpu) values (?,?,?)", + name, system.hostOS, system.hostCPU).MachineId + +proc getCommit: CommitId = + const commLen = "commit ".len + let hash = "git log -n 1"()[commLen..commLen+10] + let branch = "git symbolic-ref --short HEAD"() + if hash.len == 0 or branch.len == 0: quit "cannot determine git HEAD" + + let id = db.getValue(sql"select id from [Commit] where hash = ? and branch = ?", + hash, branch) + if id.len > 0: + result = id.parseInt.CommitId + else: + result = db.insertId(sql"insert into [Commit](hash, branch) values (?, ?)", + hash, branch).CommitId + +proc writeTestResult*(name, category, target, + action, result, expected, given: string) = + let id = db.getValue(sql"""select id from TestResult + where name = ? and category = ? and target = ? and + machine = ? and [commit] = ?""", + name, category, target, + thisMachine, thisCommit) + if id.len > 0: + db.exec(sql"""update TestResult + set action = ?, result = ?, expected = ?, given = ? + where id = ?""", action, result, expected, given, id) + else: + db.exec(sql"""insert into TestResult(name, category, target, + action, + result, expected, given, + [commit], machine) + values (?,?,?,?,?,?,?,?,?) """, name, category, target, + action, + result, expected, given, + thisCommit, thisMachine) + +proc open*() = + db = open(connection="testament.db", user="testament", password="", + database="testament") + createDb() + thisMachine = getMachine() + thisCommit = getCommit() + +proc close*() = close(db) diff --git a/tests/caasdriver.nim b/tests/testament/caasdriver.nim index 28f0bae9b..28f0bae9b 100644 --- a/tests/caasdriver.nim +++ b/tests/testament/caasdriver.nim diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim new file mode 100644 index 000000000..5dd841447 --- /dev/null +++ b/tests/testament/categories.nim @@ -0,0 +1,264 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Include for the tester that contains test suites that test special features +## of the compiler. + +# included from tester.nim +# ---------------- ROD file tests --------------------------------------------- + +const + rodfilesDir = "tests/rodfiles" + nimcacheDir = rodfilesDir / "nimcache" + +proc delNimCache() = + try: + removeDir(nimcacheDir) + except EOS: + echo "[Warning] could not delete: ", nimcacheDir + +proc runRodFiles(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(rodfilesDir / filename, options, cat, actionRun) + + delNimCache() + + # test basic recompilation scheme: + test "hallo" + test "hallo" + # test incremental type information: + test "hallo2" + delNimCache() + + # test type converters: + test "aconv" + test "bconv" + delNimCache() + + # test G, A, B example from the documentation; test init sections: + test "deada" + test "deada2" + delNimCache() + + # test method generation: + test "bmethods" + test "bmethods2" + delNimCache() + + # test generics: + test "tgeneric1" + test "tgeneric2" + delNimCache() + +proc compileRodFiles(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(rodfilesDir / filename, options, cat) + + delNimCache() + # test DLL interfacing: + test "gtkex1" + test "gtkex2" + delNimCache() + +# --------------------- DLL generation tests ---------------------------------- + +proc safeCopyFile(src, dest: string) = + try: + copyFile(src, dest) + except EOS: + echo "[Warning] could not copy: ", src, " to ", dest + +proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) = + testSpec c, makeTest("lib/nimrtl.nim", + options & " --app:lib -d:createNimRtl", cat) + testSpec c, makeTest("tests/dll/server.nim", + options & " --app:lib -d:useNimRtl", cat) + + when defined(Windows): + # windows looks in the dir of the exe (yay!): + var nimrtlDll = DynlibFormat % "nimrtl" + safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll) + else: + # posix relies on crappy LD_LIBRARY_PATH (ugh!): + var libpath = getenv"LD_LIBRARY_PATH".string + if peg"\i '/nimrod' (!'/')* '/lib'" notin libpath: + echo "[Warning] insufficient LD_LIBRARY_PATH" + var serverDll = DynlibFormat % "server" + safeCopyFile("tests/dll" / serverDll, "lib" / serverDll) + + testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl", + cat, actionRun) + +proc dllTests(r: var TResults, cat: Category, options: string) = + # dummy compile result: + var c = initResults() + + runBasicDLLTest c, r, cat, options + runBasicDLLTest c, r, cat, options & " -d:release" + runBasicDLLTest c, r, cat, options & " --gc:boehm" + runBasicDLLTest c, r, cat, options & " -d:release --gc:boehm" + +# ------------------------------ GC tests ------------------------------------- + +proc gcTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest("tests/gc" / filename, options, cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release -d:useRealtimeGC", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " --gc:markAndSweep", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release --gc:markAndSweep", cat, actionRun) + + test "gcbench" + test "gcleak" + test "gcleak2" + test "gctest" + test "gcleak3" + test "weakrefs" + test "cycleleak" + test "closureleak" + +# ------------------------- threading tests ----------------------------------- + +proc threadTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest("tests/threads" / filename, options, cat, actionRun) + testSpec r, makeTest("tests/threads" / filename, options & + " -d:release", cat, actionRun) + testSpec r, makeTest("tests/threads" / filename, options & + " --tlsEmulation:on", cat, actionRun) + + test "tactors" + test "tactors2" + test "threadex" + # deactivated because output capturing still causes problems sometimes: + #test "trecursive_actor" + #test "threadring" + #test "tthreadanalysis" + #test "tthreadsort" + test "tthreadanalysis2" + test "tthreadanalysis3" + test "tthreadheapviolation1" + +# ------------------------- IO tests ------------------------------------------ + +proc ioTests(r: var TResults, cat: Category, options: string) = + # We need readall_echo to be compiled for this test to run. + # dummy compile result: + var c = initResults() + testSpec c, makeTest("tests/system/helpers/readall_echo", options, cat) + testSpec r, makeTest("tests/system/io", options, cat) + +# ------------------------- debugger tests ------------------------------------ + +proc debuggerTests(r: var TResults, cat: Category, options: string) = + testNoSpec r, makeTest("tools/nimgrep", options & " --debugger:on", cat) + +# ------------------------- JS tests ------------------------------------------ + +proc jsTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(filename, options & " -d:nodejs", cat, + actionRun, targetJS) + testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat, + actionRun, targetJS) + + for t in os.walkFiles("tests/js/t*.nim"): + test(t) + for testfile in ["texceptions", "texcpt1", "texcsub", "tfinally", + "tfinally2", "tfinally3", "tactiontable", "tmultim1", + "tmultim3", "tmultim4"]: + test "tests/run/" & testfile & ".nim" + +# ------------------------- manyloc ------------------------------------------- +#proc runSpecialTests(r: var TResults, options: string) = +# for t in ["lib/packages/docutils/highlite"]: +# testSpec(r, t, options) + +proc findMainFile(dir: string): string = + # finds the file belonging to ".nimrod.cfg"; if there is no such file + # it returns the some ".nim" file if there is only one: + const cfgExt = ".nimrod.cfg" + result = "" + var nimFiles = 0 + for kind, file in os.walkDir(dir): + if kind == pcFile: + if file.endsWith(cfgExt): return file[.. -(cfgExt.len+1)] & ".nim" + elif file.endsWith(".nim"): + if result.len == 0: result = file + inc nimFiles + if nimFiles != 1: result.setlen(0) + +proc manyLoc(r: var TResults, cat: Category, options: string) = + for kind, dir in os.walkDir("tests/manyloc"): + if kind == pcDir: + let mainfile = findMainFile(dir) + if mainfile != ".nim": + testNoSpec r, makeTest(mainfile, options, cat) + +proc compileExample(r: var TResults, pattern, options: string, cat: Category) = + for test in os.walkFiles(pattern): + testNoSpec r, makeTest(test, options, cat) + +proc testStdlib(r: var TResults, pattern, options: string, cat: Category) = + for test in os.walkFiles(pattern): + let contents = readFile(test).string + if contents.contains("when isMainModule"): + testSpec r, makeTest(test, options, cat, actionRun) + else: + testNoSpec r, makeTest(test, options, cat, actionCompile) + +# ---------------------------------------------------------------------------- + +const AdditionalCategories = ["debugger", "tools", "examples", "stdlib"] + +proc `&.?`(a, b: string): string = + # candidate for the stdlib? + result = if b.startswith(a): b else: a & b + +proc `&?.`(a, b: string): string = + # candidate for the stdlib? + result = if a.endswith(b): a else: a & b + +proc processCategory(r: var TResults, cat: Category, options: string) = + case cat.string.normalize + of "rodfiles": + compileRodFiles(r, cat, options) + runRodFiles(r, cat, options) + of "js": + # XXX JS doesn't need to be special anymore + jsTests(r, cat, options) + of "dll": + dllTests(r, cat, options) + of "gc": + gcTests(r, cat, options) + of "debugger": + debuggerTests(r, cat, options) + of "tools": + testSpec r, makeTest("compiler/c2nim/c2nim.nim", options, cat) + testSpec r, makeTest("compiler/pas2nim/pas2nim.nim", options, cat) + of "manyloc": + manyLoc r, cat, options + of "threads": + threadTests r, cat, options & " --threads:on" + of "io": + ioTests r, cat, options + of "stdlib": + testStdlib(r, "lib/pure/*.nim", options, cat) + testStdlib(r, "lib/packages/docutils/highlite", options, cat) + of "examples": + compileExample(r, "examples/*.nim", options, cat) + compileExample(r, "examples/gtk/*.nim", options, cat) + compileExample(r, "examples/talk/*.nim", options, cat) + else: + for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): + testSpec r, makeTest(name, options, cat) diff --git a/tests/css/boilerplate.css b/tests/testament/css/boilerplate.css index b209b5aa1..b209b5aa1 100644 --- a/tests/css/boilerplate.css +++ b/tests/testament/css/boilerplate.css diff --git a/tests/css/style.css b/tests/testament/css/style.css index 43a8add68..43a8add68 100644 --- a/tests/css/style.css +++ b/tests/testament/css/style.css diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim new file mode 100644 index 000000000..bc2d8bd37 --- /dev/null +++ b/tests/testament/htmlgen.nim @@ -0,0 +1,161 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## HTML generator for the tester. + +import db_sqlite, cgi, backend, strutils + +const + TableHeader = """<table border="1"> + <tr><td>Test</td><td>Category</td><td>Target</td> + <td>Action</td> + <td>Expected</td> + <td>Given</td> + <td>Success</td></tr>""" + TableFooter = "</table>" + HtmlBegin = """<html> + <head> + <title>Test results</title> + <style type="text/css"> + <!--""" & slurp("css/boilerplate.css") & "\n" & + slurp("css/style.css") & + """ +ul#tabs { list-style-type: none; margin: 30px 0 0 0; padding: 0 0 0.3em 0; } +ul#tabs li { display: inline; } +ul#tabs li a { color: #42454a; background-color: #dedbde; + border: 1px solid #c9c3ba; border-bottom: none; + padding: 0.3em; text-decoration: none; } +ul#tabs li a:hover { background-color: #f1f0ee; } +ul#tabs li a.selected { color: #000; background-color: #f1f0ee; + font-weight: bold; padding: 0.7em 0.3em 0.38em 0.3em; } +div.tabContent { border: 1px solid #c9c3ba; + padding: 0.5em; background-color: #f1f0ee; } +div.tabContent.hide { display: none; } + --> + </style> + <script> + + var tabLinks = new Array(); + var contentDivs = new Array(); + + function init() { + // Grab the tab links and content divs from the page + var tabListItems = document.getElementById('tabs').childNodes; + for (var i = 0; i < tabListItems.length; i++) { + if (tabListItems[i].nodeName == "LI") { + var tabLink = getFirstChildWithTagName(tabListItems[i], 'A'); + var id = getHash(tabLink.getAttribute('href')); + tabLinks[id] = tabLink; + contentDivs[id] = document.getElementById(id); + } + } + // Assign onclick events to the tab links, and + // highlight the first tab + var i = 0; + for (var id in tabLinks) { + tabLinks[id].onclick = showTab; + tabLinks[id].onfocus = function() { this.blur() }; + if (i == 0) tabLinks[id].className = 'selected'; + i++; + } + // Hide all content divs except the first + var i = 0; + for (var id in contentDivs) { + if (i != 0) contentDivs[id].className = 'tabContent hide'; + i++; + } + } + + function showTab() { + var selectedId = getHash(this.getAttribute('href')); + + // Highlight the selected tab, and dim all others. + // Also show the selected content div, and hide all others. + for (var id in contentDivs) { + if (id == selectedId) { + tabLinks[id].className = 'selected'; + contentDivs[id].className = 'tabContent'; + } else { + tabLinks[id].className = ''; + contentDivs[id].className = 'tabContent hide'; + } + } + // Stop the browser following the link + return false; + } + + function getFirstChildWithTagName(element, tagName) { + for (var i = 0; i < element.childNodes.length; i++) { + if (element.childNodes[i].nodeName == tagName) return element.childNodes[i]; + } + } + function getHash(url) { + var hashPos = url.lastIndexOf('#'); + return url.substring(hashPos + 1); + } + </script> + + </head> + <body onload="init()">""" + + HtmlEnd = "</body></html>" + +proc td(s: string): string = + result = "<td>" & s.substr(0, 200).XMLEncode & "</td>" + +proc getCommit(db: TDbConn, c: int): string = + var commit = c + for thisCommit in db.rows(sql"select id from [Commit] order by id desc"): + if commit == 0: result = thisCommit[0] + inc commit + if result.isNil: + quit "cannot determine commit " & $c + +proc generateHtml*(filename: string, commit: int) = + const selRow = """select name, category, target, action, + expected, given, result + from TestResult + where [commit] = ? and machine = ? + order by category""" + var db = open(connection="testament.db", user="testament", password="", + database="testament") + # search for proper commit: + let lastCommit = db.getCommit(commit) + + var outfile = open(filename, fmWrite) + outfile.write(HtmlBegin) + + let commit = db.getValue(sql"select hash from [Commit] where id = ?", + lastCommit) + let branch = db.getValue(sql"select branch from [Commit] where id = ?", + lastCommit) + outfile.write("<p><b>$# $#</b></p>" % [branch, commit]) + + # generate navigation: + outfile.write("""<ul id="tabs">""") + for m in db.rows(sql"select id, name, os, cpu from Machine order by id"): + outfile.writeln """<li><a href="#$#">$#: $#, $#</a></li>""" % m + outfile.write("</ul>") + + for currentMachine in db.rows(sql"select id from Machine order by id"): + let m = currentMachine[0] + outfile.write("""<div class="tabContent" id="$#">""" % m) + + outfile.write(TableHeader) + for row in db.rows(sql(selRow), lastCommit, m): + outfile.write("<tr>") + for x in row: + outfile.write(x.td) + outfile.write("</tr>") + + outfile.write(TableFooter) + outfile.write("</div>") + outfile.write(HtmlEnd) + close(db) + close(outfile) diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim new file mode 100644 index 000000000..e97015946 --- /dev/null +++ b/tests/testament/specs.nim @@ -0,0 +1,130 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +import parseutils, strutils, os, osproc, streams, parsecfg + +const + cmdTemplate* = r"nimrod cc --hints:on $# $#" + +type + TTestAction* = enum + actionCompile = "compile" + actionRun = "run" + actionReject = "reject" + TResultEnum* = enum + reNimrodcCrash, # nimrod compiler seems to have crashed + reMsgsDiffer, # error messages differ + reFilesDiffer, # expected and given filenames differ + reLinesDiffer, # expected and given line numbers differ + reOutputsDiffer, + reExitcodesDiffer, + reInvalidPeg, + reCodegenFailure, + reCodeNotFound, + reExeNotFound, + reIgnored, # test is ignored + reSuccess # test was successful + TTarget* = enum + targetC = "C" + targetCpp = "C++" + targetObjC = "ObjC" + targetJS = "JS" + + TSpec* = object + action*: TTestAction + file*, cmd*: string + outp*: string + line*, exitCode*: int + msg*: string + ccodeCheck*: string + err*: TResultEnum + substr*: bool + targets*: set[TTarget] + +const + targetToExt*: array[TTarget, string] = ["c", "cpp", "m", "js"] + +when not defined(parseCfgBool): + # candidate for the stdlib: + proc parseCfgBool(s: string): bool = + case normalize(s) + of "y", "yes", "true", "1", "on": result = true + of "n", "no", "false", "0", "off": result = false + else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) + +proc extractSpec(filename: string): string = + const tripleQuote = "\"\"\"" + var x = readFile(filename).string + var a = x.find(tripleQuote) + var b = x.find(tripleQuote, a+3) + # look for """ only in the first section + if a >= 0 and b > a and a < 40: + result = x.substr(a+3, b-1).replace("'''", tripleQuote) + else: + #echo "warning: file does not contain spec: " & filename + result = "" + +when not defined(nimhygiene): + {.pragma: inject.} + +template parseSpecAux(fillResult: stmt) {.immediate.} = + var ss = newStringStream(extractSpec(filename)) + var p {.inject.}: TCfgParser + open(p, ss, filename, 1) + while true: + var e {.inject.} = next(p) + case e.kind + of cfgEof: break + of cfgSectionStart, cfgOption, cfgError: + echo ignoreMsg(p, e) + of cfgKeyValuePair: + fillResult + close(p) + +proc parseSpec*(filename: string): TSpec = + result.file = filename + result.msg = "" + result.outp = "" + result.ccodeCheck = "" + result.cmd = cmdTemplate + parseSpecAux: + case normalize(e.key) + of "action": + case e.value.normalize + of "compile": result.action = actionCompile + of "run": result.action = actionRun + of "reject": result.action = actionReject + else: echo ignoreMsg(p, e) + of "file": result.file = e.value + of "line": discard parseInt(e.value, result.line) + of "output": + result.action = actionRun + result.outp = e.value + of "outputsub": + result.action = actionRun + result.outp = e.value + result.substr = true + of "exitcode": + discard parseInt(e.value, result.exitCode) + of "errormsg", "msg": + result.msg = e.value + result.action = actionReject + of "disabled": + if parseCfgBool(e.value): result.err = reIgnored + of "cmd": result.cmd = e.value + of "ccodecheck": result.ccodeCheck = e.value + of "target", "targets": + for v in e.value.normalize.split: + case v + of "c": result.targets.incl(targetC) + of "cpp", "c++": result.targets.incl(targetCpp) + of "objc": result.targets.incl(targetObjC) + of "js": result.targets.incl(targetJS) + else: echo ignoreMsg(p, e) + else: echo ignoreMsg(p, e) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim new file mode 100644 index 000000000..54a6de2d0 --- /dev/null +++ b/tests/testament/tester.nim @@ -0,0 +1,273 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This program verifies Nimrod against the testcases. + +import + parseutils, strutils, pegs, os, osproc, streams, parsecfg, json, + marshal, backend, parseopt, specs, htmlgen, browsers + +const + resultsFile = "testresults.html" + jsonFile = "testresults.json" + Usage = """Usage: + tester [options] command [arguments] + +Command: + all run all tests + c|category <category> run all the tests of a certain category + html [commit] generate $1 from the database; uses the latest + commit or a specific one (use -1 for the commit + before latest etc) +Arguments: + arguments are passed to the compiler +Options: + --print also print results to the console +""" % resultsFile + +type + Category = distinct string + TResults = object + total, passed, skipped: int + data: string + + TTest = object + name: string + cat: Category + options: string + target: TTarget + action: TTestAction + +# ---------------------------------------------------------------------------- + +let + pegLineError = + peg"{[^(]*} '(' {\d+} ', ' \d+ ') ' ('Error'/'Warning') ':' \s* {.*}" + pegOtherError = peg"'Error:' \s* {.*}" + pegSuccess = peg"'Hint: operation successful'.*" + pegOfInterest = pegLineError / pegOtherError + +proc callCompiler(cmdTemplate, filename, options: string): TSpec = + let c = parseCmdLine(cmdTemplate % [options, filename]) + var p = startProcess(command=c[0], args=c[1.. -1], + options={poStdErrToStdOut, poUseShell}) + let outp = p.outputStream + var suc = "" + var err = "" + var x = newStringOfCap(120) + while outp.readLine(x.TaintedString) or running(p): + if x =~ pegOfInterest: + # `err` should contain the last error/warning message + err = x + elif x =~ pegSuccess: + suc = x + close(p) + result.msg = "" + result.file = "" + result.outp = "" + result.line = -1 + if err =~ pegLineError: + result.file = extractFilename(matches[0]) + result.line = parseInt(matches[1]) + result.msg = matches[2] + elif err =~ pegOtherError: + result.msg = matches[0] + elif suc =~ pegSuccess: + result.err = reSuccess + +proc initResults: TResults = + result.total = 0 + result.passed = 0 + result.skipped = 0 + result.data = "" + +proc readResults(filename: string): TResults = + result = marshal.to[TResults](readFile(filename).string) + +proc writeResults(filename: string, r: TResults) = + writeFile(filename, $$r) + +proc `$`(x: TResults): string = + result = ("Tests passed: $1 / $3 <br />\n" & + "Tests skipped: $2 / $3 <br />\n") % + [$x.passed, $x.skipped, $x.total] + +proc addResult(r: var TResults, test: TTest, + expected, given: string, success: TResultEnum) = + let name = test.name.extractFilename & test.options + backend.writeTestResult(name = name, + category = test.cat.string, + target = $test.target, + action = $test.action, + result = $success, + expected = expected, + given = given) + r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success) + +proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = + if strip(expected.msg) notin strip(given.msg): + r.addResult(test, expected.msg, given.msg, reMsgsDiffer) + elif extractFilename(expected.file) != extractFilename(given.file) and + "internal error:" notin expected.msg: + r.addResult(test, expected.file, given.file, reFilesDiffer) + elif expected.line != given.line and expected.line != 0: + r.addResult(test, $expected.line, $given.line, reLinesDiffer) + else: + r.addResult(test, expected.msg, given.msg, reSuccess) + inc(r.passed) + +proc generatedFile(path, name: string, target: TTarget): string = + let ext = targetToExt[target] + result = path / "nimcache" / + (if target == targetJS: path.splitPath.tail & "_" else: "") & + name.changeFileExt(ext) + +proc codegenCheck(test: TTest, check: string, given: var TSpec) = + if check.len > 0: + try: + let (path, name, ext2) = test.name.splitFile + let genFile = generatedFile(path, name, test.target) + echo genFile + let contents = readFile(genFile).string + if contents.find(check.peg) < 0: + given.err = reCodegenFailure + except EInvalidValue: + given.err = reInvalidPeg + except EIO: + given.err = reCodeNotFound + +proc testSpec(r: var TResults, test: TTest) = + # major entry point for a single test + let tname = test.name.addFileExt(".nim") + inc(r.total) + echo extractFilename(tname) + var expected = parseSpec(tname) + if expected.err == reIgnored: + r.addResult(test, "", "", reIgnored) + inc(r.skipped) + else: + case expected.action + of actionCompile: + var given = callCompiler(expected.cmd, test.name, test.options) + if given.err == reSuccess: + codegenCheck(test, expected.ccodeCheck, given) + r.addResult(test, "", given.msg, given.err) + if given.err == reSuccess: inc(r.passed) + of actionRun: + var given = callCompiler(expected.cmd, test.name, test.options) + if given.err != reSuccess: + r.addResult(test, "", given.msg, given.err) + else: + var exeFile: string + if test.target == targetJS: + let (dir, file, ext) = splitFile(tname) + exeFile = dir / "nimcache" / file & ".js" + else: + exeFile = changeFileExt(tname, ExeExt) + + if existsFile(exeFile): + var (buf, exitCode) = execCmdEx( + (if test.target==targetJS: "node " else: "") & exeFile) + if exitCode != expected.ExitCode: + r.addResult(test, "exitcode: " & $expected.exitCode, + "exitcode: " & $exitCode, reExitCodesDiffer) + else: + if strip(buf.string) != strip(expected.outp): + if not (expected.substr and expected.outp in buf.string): + given.err = reOutputsDiffer + if given.err == reSuccess: + codeGenCheck(test, expected.ccodeCheck, given) + if given.err == reSuccess: inc(r.passed) + r.addResult(test, expected.outp, buf.string, given.err) + else: + r.addResult(test, expected.outp, "executable not found", reExeNotFound) + of actionReject: + var given = callCompiler(expected.cmd, test.name, test.options) + cmpMsgs(r, expected, given, test) + +proc testNoSpec(r: var TResults, test: TTest) = + # does not extract the spec because the file is not supposed to have any + let tname = test.name.addFileExt(".nim") + inc(r.total) + echo extractFilename(tname) + let given = callCompiler(cmdTemplate, test.name, test.options) + r.addResult(test, "", given.msg, given.err) + if given.err == reSuccess: inc(r.passed) + +proc makeTest(test, options: string, cat: Category, action = actionCompile, + target = targetC): TTest = + # start with 'actionCompile', will be overwritten in the spec: + result = TTest(cat: cat, name: test, options: options, + target: target, action: action) + +include categories + +proc toJson(res: TResults): PJsonNode = + result = newJObject() + result["total"] = newJInt(res.total) + result["passed"] = newJInt(res.passed) + result["skipped"] = newJInt(res.skipped) + +proc outputJson(reject, compile, run: TResults) = + var doc = newJObject() + doc["reject"] = toJson(reject) + doc["compile"] = toJson(compile) + doc["run"] = toJson(run) + var s = pretty(doc) + writeFile(jsonFile, s) + +# proc runCaasTests(r: var TResults) = +# for test, output, status, mode in caasTestsRunner(): +# r.addResult(test, "", output & "-> " & $mode, +# if status: reSuccess else: reOutputsDiffer) + +proc main() = + os.putenv "NIMTEST_NO_COLOR", "1" + os.putenv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES" + + backend.open() + var optPrintResults = false + var p = initOptParser() + p.next() + if p.kind == cmdLongoption: + case p.key.string.normalize + of "print", "verbose": optPrintResults = true + else: quit usage + p.next() + if p.kind != cmdArgument: quit usage + var action = p.key.string.normalize + p.next() + var r = initResults() + case action + of "all": + for kind, dir in walkDir("tests"): + if kind == pcDir and dir notin ["testament", "testdata", "nimcache"]: + processCategory(r, Category(dir), p.cmdLineRest.string) + for a in AdditionalCategories: + processCategory(r, Category(a), p.cmdLineRest.string) + of "c", "cat", "category": + var cat = Category(p.key) + p.next + processCategory(r, cat, p.cmdLineRest.string) + of "html": + var commit = 0 + discard parseInt(p.cmdLineRest.string, commit) + generateHtml(resultsFile, commit) + else: + quit usage + + if optPrintResults: + if action == "html": openDefaultBrowser(resultsFile) + else: echo r, r.data + backend.close() + +if paramCount() == 0: + quit usage +main() + diff --git a/tests/reject/tdisallowif.nim b/tests/trmacros/tdisallowif.nim index 10f54288a..18dfd1c82 100644 --- a/tests/reject/tdisallowif.nim +++ b/tests/trmacros/tdisallowif.nim @@ -1,6 +1,7 @@ discard """ line: 24 errormsg: "usage of 'disallowIf' is a user-defined error" + disabled: true """ template optZero{x+x}(x: int): int = x*3 @@ -25,4 +26,4 @@ if s[0] != "hi": echo "do it" echo "more branches" else: - nil + discard diff --git a/tests/run/tanontuples.nim b/tests/tuples/tanontuples.nim index a2babf038..a2babf038 100644 --- a/tests/run/tanontuples.nim +++ b/tests/tuples/tanontuples.nim diff --git a/tests/reject/twrongtupleaccess.nim b/tests/tuples/twrongtupleaccess.nim index 1a9ae64a2..1a9ae64a2 100644 --- a/tests/reject/twrongtupleaccess.nim +++ b/tests/tuples/twrongtupleaccess.nim diff --git a/tests/compile/tcommontype.nim b/tests/typerel/tcommontype.nim index 8215ebd5e..8215ebd5e 100644 --- a/tests/compile/tcommontype.nim +++ b/tests/typerel/tcommontype.nim diff --git a/tests/reject/tno_int_in_bool_context.nim b/tests/typerel/tno_int_in_bool_context.nim index 755a02c0c..755a02c0c 100644 --- a/tests/reject/tno_int_in_bool_context.nim +++ b/tests/typerel/tno_int_in_bool_context.nim diff --git a/tests/compile/tnoargopenarray.nim b/tests/typerel/tnoargopenarray.nim index 872ec86d2..872ec86d2 100644 --- a/tests/compile/tnoargopenarray.nim +++ b/tests/typerel/tnoargopenarray.nim diff --git a/tests/reject/tnocontains.nim b/tests/typerel/tnocontains.nim index 4f4951478..4f4951478 100644 --- a/tests/reject/tnocontains.nim +++ b/tests/typerel/tnocontains.nim diff --git a/tests/compile/trectuple.nim b/tests/typerel/trectuple.nim index 7c43ec5ba..7c43ec5ba 100644 --- a/tests/compile/trectuple.nim +++ b/tests/typerel/trectuple.nim diff --git a/tests/compile/trectuples.nim b/tests/typerel/trectuples.nim index c59cfe880..c59cfe880 100644 --- a/tests/compile/trectuples.nim +++ b/tests/typerel/trectuples.nim diff --git a/tests/reject/trectype.nim b/tests/typerel/trectype.nim index 7bb12a3b6..7bb12a3b6 100644 --- a/tests/reject/trectype.nim +++ b/tests/typerel/trectype.nim diff --git a/tests/reject/trefs.nim b/tests/typerel/trefs.nim index b157ca2b5..b157ca2b5 100644 --- a/tests/reject/trefs.nim +++ b/tests/typerel/trefs.nim diff --git a/tests/run/trettypeinference.nim b/tests/typerel/trettypeinference.nim index 41b4aa5ef..41b4aa5ef 100644 --- a/tests/run/trettypeinference.nim +++ b/tests/typerel/trettypeinference.nim diff --git a/tests/compile/tsecondarrayproperty.nim b/tests/typerel/tsecondarrayproperty.nim index 07fdac1c4..07fdac1c4 100644 --- a/tests/compile/tsecondarrayproperty.nim +++ b/tests/typerel/tsecondarrayproperty.nim diff --git a/tests/compile/ttuple1.nim b/tests/typerel/ttuple1.nim index 5787cc309..5787cc309 100644 --- a/tests/compile/ttuple1.nim +++ b/tests/typerel/ttuple1.nim diff --git a/tests/reject/ttypelessemptyset.nim b/tests/typerel/ttypelessemptyset.nim index 3e171387b..3e171387b 100644 --- a/tests/reject/ttypelessemptyset.nim +++ b/tests/typerel/ttypelessemptyset.nim diff --git a/tests/reject/ttypenoval.nim b/tests/typerel/ttypenoval.nim index 214b35e29..214b35e29 100644 --- a/tests/reject/ttypenoval.nim +++ b/tests/typerel/ttypenoval.nim diff --git a/tests/reject/ttypenovalue.nim b/tests/typerel/ttypenovalue.nim index b86baf8b4..b86baf8b4 100644 --- a/tests/reject/ttypenovalue.nim +++ b/tests/typerel/ttypenovalue.nim diff --git a/tests/compile/tvoid.nim b/tests/typerel/tvoid.nim index bb569e7f8..bb569e7f8 100644 --- a/tests/compile/tvoid.nim +++ b/tests/typerel/tvoid.nim diff --git a/tests/compile/typalias.nim b/tests/typerel/typalias.nim index ba9f38ed9..ba9f38ed9 100644 --- a/tests/compile/typalias.nim +++ b/tests/typerel/typalias.nim diff --git a/tests/reject/typredef.nim b/tests/typerel/typredef.nim index b2182d116..0b6aed875 100644 --- a/tests/reject/typredef.nim +++ b/tests/typerel/typredef.nim @@ -3,8 +3,6 @@ discard """ line: 7 errormsg: "illegal recursion in type \'Uint8\'" """ -type - Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' - - +type + Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' diff --git a/tests/run/tfinalobj.nim b/tests/types/tfinalobj.nim index 1cd7fae28..1cd7fae28 100644 --- a/tests/run/tfinalobj.nim +++ b/tests/types/tfinalobj.nim diff --git a/tests/compile/tforwty.nim b/tests/types/tforwty.nim index 0f1d3697f..0f1d3697f 100644 --- a/tests/compile/tforwty.nim +++ b/tests/types/tforwty.nim diff --git a/tests/compile/tforwty2.nim b/tests/types/tforwty2.nim index 5d15e112a..5d15e112a 100644 --- a/tests/compile/tforwty2.nim +++ b/tests/types/tforwty2.nim diff --git a/tests/reject/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim index 711f458bf..711f458bf 100644 --- a/tests/reject/tillegaltyperecursion.nim +++ b/tests/types/tillegaltyperecursion.nim diff --git a/tests/reject/tillrec.nim b/tests/types/tillrec.nim index 3f8fe60fc..1d1ec0622 100644 --- a/tests/reject/tillrec.nim +++ b/tests/types/tillrec.nim @@ -3,15 +3,14 @@ discard """ line: 13 errormsg: "illegal recursion in type \'TIllegal\'" """ -# test illegal recursive types - -type - TLegal {.final.} = object - x: int - kids: seq[TLegal] - - TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' - y: Int - x: array[0..3, TIllegal] +# test illegal recursive types +type + TLegal {.final.} = object + x: int + kids: seq[TLegal] + + TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' + y: Int + x: array[0..3, TIllegal] diff --git a/tests/compile/tinheritref.nim b/tests/types/tinheritref.nim index e5de6a4be..e5de6a4be 100644 --- a/tests/compile/tinheritref.nim +++ b/tests/types/tinheritref.nim diff --git a/tests/compile/tisop.nim b/tests/types/tisop.nim index 509cc4e95..509cc4e95 100644 --- a/tests/compile/tisop.nim +++ b/tests/types/tisop.nim diff --git a/tests/run/tisopr.nim b/tests/types/tisopr.nim index 6d3c51749..6d3c51749 100644 --- a/tests/run/tisopr.nim +++ b/tests/types/tisopr.nim diff --git a/tests/run/tusingstatement.nim b/tests/usingstmt/tusingstatement.nim index b9d466377..a33aced4c 100644 --- a/tests/run/tusingstatement.nim +++ b/tests/usingstmt/tusingstatement.nim @@ -8,25 +8,11 @@ import # This macro mimics the using statement from C# # -# XXX: -# It doen't match the C# version exactly yet. -# In particular, it's not recursive, which prevents it from dealing -# with exceptions thrown from the variable initializers when multiple. -# variables are used. +# It's kept only as a test for the macro system +# Nimrod's destructors offer a mechanism for automatic +# disposal of resources. # -# Also, since nimrod relies less on exceptions in general, a more -# idiomatic definition could be: -# var x = init() -# if opened(x): -# try: -# body -# finally: -# close(x) -# -# `opened` here could be an overloaded proc which any type can define. -# A common practice can be returing an Optional[Resource] obj for which -# `opened` is defined to `optional.hasValue` -macro using(e: expr): stmt {.immediate.} = +macro autoClose(e: expr): stmt {.immediate.} = let e = callsite() if e.len != 3: error "Using statement: unexpected number of arguments. Got " & @@ -97,7 +83,7 @@ proc close(r: var TResource) = proc use(r: var TResource) = write(stdout, "Using " & r.field & ".") -using(r = openResource("test")): +autoClose(r = openResource("test")): use r diff --git a/tests/reject/tvarres1.nim b/tests/varres/tvarres1.nim index de4a505d3..de4a505d3 100644 --- a/tests/reject/tvarres1.nim +++ b/tests/varres/tvarres1.nim diff --git a/tests/reject/tvarres2.nim b/tests/varres/tvarres2.nim index 165e4a36e..165e4a36e 100644 --- a/tests/reject/tvarres2.nim +++ b/tests/varres/tvarres2.nim diff --git a/tests/run/tvarres1.nim b/tests/varres/tvarres3.nim index a48c961df..a48c961df 100644 --- a/tests/run/tvarres1.nim +++ b/tests/varres/tvarres3.nim diff --git a/tests/run/tvarres2.nim b/tests/varres/tvarres4.nim index 119560e7b..119560e7b 100644 --- a/tests/run/tvarres2.nim +++ b/tests/varres/tvarres4.nim diff --git a/tests/run/tvartup.nim b/tests/varres/tvartup.nim index f885cdf37..f885cdf37 100644 --- a/tests/run/tvartup.nim +++ b/tests/varres/tvartup.nim diff --git a/tests/run/tlet.nim b/tests/varstmt/tlet.nim index ba355c5d8..ba355c5d8 100644 --- a/tests/run/tlet.nim +++ b/tests/varstmt/tlet.nim diff --git a/tests/run/tvardecl.nim b/tests/varstmt/tvardecl.nim index 5cc6f4960..5cc6f4960 100644 --- a/tests/run/tvardecl.nim +++ b/tests/varstmt/tvardecl.nim diff --git a/tests/compile/tconsteval.nim b/tests/vm/tconsteval.nim index 16fd8f4b8..16fd8f4b8 100644 --- a/tests/compile/tconsteval.nim +++ b/tests/vm/tconsteval.nim diff --git a/tests/compile/teval1.nim b/tests/vm/teval1.nim index a02f26592..a02f26592 100644 --- a/tests/compile/teval1.nim +++ b/tests/vm/teval1.nim diff --git a/tests/compile/tslurp.nim b/tests/vm/tslurp.nim index f9456ce6b..f9456ce6b 100644 --- a/tests/compile/tslurp.nim +++ b/tests/vm/tslurp.nim diff --git a/tests/reject/twrongconst.nim b/tests/vm/twrongconst.nim index 16fe3bff6..e5b8a15bd 100644 --- a/tests/reject/twrongconst.nim +++ b/tests/vm/twrongconst.nim @@ -1,6 +1,6 @@ discard """ - output: "Error: constant expression expected" - line: 7 + output: "Error: cannot evaluate at compile time: x" + line: 10 """ var x: array[100, char] |