From 20b5f31c03fb556ec0aa2428a40adbac004d8987 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 13 Jan 2014 02:10:03 +0100 Subject: [PATCH] new tester; all tests categorized --- koch.nim | 9 +- tests/{run => actiontable}/tactiontable.nim | 0 .../{reject => actiontable}/tactiontable2.nim | 0 tests/{compile => alias}/talias.nim | 0 tests/{reject => ambsym}/mambsym1.nim | 0 tests/{reject => ambsym}/mambsym2.nim | 0 tests/{run => ambsym}/mambsys1.nim | 0 tests/{run => ambsym}/mambsys2.nim | 0 tests/{reject => ambsym}/tambsym.nim | 0 tests/{run => ambsym}/tambsym2.nim | 0 tests/{reject => ambsym}/tambsym3.nim | 0 tests/{run => ambsym}/tambsys.nim | 0 tests/{run => array}/tarray.nim | 0 tests/{run => array}/tarray2.nim | 0 tests/{run => array}/tarray3.nim | 0 tests/{reject => array}/tarraycons.nim | 0 .../tarraycons.nim => array/tarraycons2.nim} | 0 tests/{reject => array}/tarrayplus.nim | 0 tests/{compile => array}/tarrindx.nim | 0 tests/{run => assert}/tassert.nim | 0 tests/{run => assert}/tfailedassert.nim | 0 tests/{run => assert}/tunittests.nim | 0 tests/{run => assert}/tuserassert.nim | 0 tests/{compile => assign}/tassign.nim | 0 tests/{run => assign}/tcopy.nim | 0 tests/{run => assign}/tgenericassign.nim | 0 .../{run => assign}/tgenericassigntuples.nim | 0 tests/{run => assign}/tobjasgn.nim | 0 tests/{run => assign}/tvariantasgn.nim | 0 tests/{run => astoverload}/tastoverload1.nim | 0 tests/{run => async}/tasynciossl.nim | 0 tests/{run => async}/tasyncudp.nim | 0 tests/{run => bind}/mbind3.nim | 0 tests/{run => bind}/tbind1.nim | 0 tests/{reject => bind}/tbind2.nim | 0 tests/{run => bind}/tbind3.nim | 0 tests/{compile => bind}/tbindoverload.nim | 0 tests/{reject => bind}/tbindtypedesc.nim | 0 tests/{compile => bind}/tdatabind.nim | 0 tests/{run => bind}/tmixin.nim | 0 .../tnicerrorforsymchoice.nim | 0 tests/{reject => block}/tblock1.nim | 0 tests/{run => borrow}/tborrow.nim | 0 tests/{reject => borrow}/tinvalidborrow.nim | 0 tests/{run => casestmt}/tcase_setconstr.nim | 0 tests/{reject => casestmt}/tcaseexpr1.nim | 0 .../tcaseoverlaprange.nim | 0 .../tcaseoverlaprange2.nim | 0 tests/{run => casestmt}/tcasestm.nim | 0 tests/{compile => casestmt}/tcomputedgoto.nim | 0 .../{compile => casestmt}/tlinearscanend.nim | 0 tests/{compile => ccgbugs}/tccgen1.nim | 0 tests/{run => ccgbugs}/tcgbug.nim | 0 tests/{compile => ccgbugs}/tcodegenbug1.nim | 0 tests/{run => closure}/tclosure.nim | 0 tests/{run => closure}/tclosure2.nim | 0 tests/{run => closure}/tclosure3.nim | 0 tests/{compile => closure}/tclosure4.nim | 0 tests/{compile => closure}/tclosurebug2.nim | 0 tests/{run => closure}/tinterf.nim | 0 tests/{reject => closure}/tinvalidclosure.nim | 0 .../{reject => closure}/tinvalidclosure2.nim | 0 .../tnamedparamanonproc.nim | 0 tests/{compile => closure}/tnestedproc.nim | 0 tests/{run => closure}/uclosures.nim | 0 tests/{run => cnstseq}/tcnstseq.nim | 0 tests/{run => cnstseq}/tcnstseq2.nim | 0 tests/{run => cnstseq}/tcnstseq3.nim | 0 tests/compile/mvarious.nim | 6 - tests/compile/sunset.tmpl | 68 ---- tests/compile/tambsym2.nim | 6 - tests/compile/tcmdline.nim | 14 - tests/compile/tcolonisproc.nim | 12 - tests/compile/tdllvar.nim | 16 - tests/compile/temptyecho.nim | 2 - tests/compile/tendian.nim | 3 - tests/compile/tfib.nim | 11 - tests/compile/tgetstartmilsecs.nim | 7 - tests/compile/tgtk.nim | 51 --- tests/compile/thallo.nim | 85 ----- tests/compile/theaproots.nim | 71 ---- tests/compile/tlastmod.nim | 18 - tests/compile/tlibs.nim | 24 -- tests/compile/tloops.nim | 87 ----- tests/compile/tmandelbrot.nim | 57 ---- tests/compile/tnew.nim | 49 --- tests/compile/tnewlibs.nim | 17 - tests/compile/tnewsets.nim | 6 - tests/compile/tnewuns.nim | 12 - tests/compile/tnoforward.nim | 10 - tests/compile/tparedef.nim | 4 - tests/compile/tprep.nim | 30 -- tests/compile/tquicksort.nim | 26 -- tests/compile/tradix.nim | 319 ------------------ tests/compile/treadln.nim | 12 - tests/compile/treadx.nim | 14 - tests/compile/tshadow_magic_type.nim | 24 -- tests/compile/tsizeof.nim | 10 - tests/compile/tstrace.nim | 16 - tests/compile/tstrdesc.nim | 14 - tests/compile/tstrdist.nim | 26 -- tests/compile/tvarious.nim | 63 ---- tests/{compile => compiles}/tcompiles.nim | 0 tests/{run => concat}/tconcat.nim | 0 tests/{run => concurrency}/tnodeadlocks.nim | 0 tests/{reject => constr}/tconstr1.nim | 0 tests/{run => constr}/tconstr2.nim | 0 .../{reject => constraints}/tconstraints.nim | 0 tests/{run => controlflow}/tcontinue.nim | 0 tests/{reject => controlflow}/tstatret.nim | 0 tests/{compile => converter}/tconvcolors.nim | 0 tests/{compile => converter}/tconvert.nim | 0 .../{run => converter}/tgenericconverter.nim | 0 .../ttypeconverter1.nim | 0 .../mdefaultprocparam.nim | 0 .../tdefaultprocparam.nim | 0 tests/{reject => deprecated}/tdeprecated.nim | 0 tests/{run => destructor}/tdestructor.nim | 0 .../tdestructor2.nim} | 0 .../{compile => destructor}/tdictdestruct.nim | 0 tests/{compile => discard}/tdiscardable.nim | 0 tests/{reject => discard}/tneedsdiscard.nim | 0 tests/{run => distinct}/tcurrncy.nim | 0 tests/{reject => effects}/teffects1.nim | 0 tests/{reject => effects}/teffects2.nim | 0 tests/{reject => effects}/teffects3.nim | 0 tests/{reject => effects}/teffects4.nim | 0 tests/{reject => effects}/teffects5.nim | 0 .../teffects1.nim => effects/teffects6.nim} | 0 tests/{reject => effects}/tsidee1.nim | 0 tests/{run => effects}/tsidee2.nim | 0 tests/{run => effects}/tsidee3.nim | 0 tests/{reject => effects}/tsidee4.nim | 0 tests/{compile => enum}/tenum.nim | 0 tests/{compile => enum}/tenum2.nim | 0 tests/{compile => enum}/tenum3.nim | 0 tests/{run => enum}/tenumhole.nim | 0 tests/{reject => enum}/tenumitems.nim | 0 .../tenumitems.nim => enum/tenumitems2.nim} | 0 tests/{reject => enum}/tenummix.nim | 0 tests/{run => enum}/tnamedenumfields.nim | 0 tests/{compile => enum}/toptions.nim | 0 tests/{run => exception}/tcontinuexc.nim | 0 tests/{run => exception}/texceptions.nim | 0 tests/{run => exception}/texcpt1.nim | 0 tests/{run => exception}/texcsub.nim | 0 tests/{run => exception}/tfinally.nim | 0 tests/{run => exception}/tfinally2.nim | 0 tests/{run => exception}/tfinally3.nim | 0 tests/{run => exception}/tonraise.nim | 0 tests/{run => exception}/treraise.nim | 0 tests/{run => exception}/tunhandledexc.nim | 0 tests/{run => exception}/twrongexc.nim | 0 tests/{reject => exprs}/texprstmt.nim | 0 tests/{reject => exprs}/tstmtexp.nim | 0 tests/{run => exprs}/tstmtexprs.nim | 0 tests/{run => fields}/tfieldindex.nim | 0 tests/{run => fields}/tfielditerator.nim | 0 tests/{run => fields}/tfielditerator2.nim | 0 tests/{run => float}/tfloat1.nim | 0 tests/{run => float}/tfloat2.nim | 0 tests/{run => float}/tfloat3.nim | 0 tests/{run => friends}/mfriends.nim | 0 tests/{run => friends}/tfriends.nim | 0 tests/{run => generics}/tbintre2.nim | 0 tests/{run => generics}/tbintree.nim | 0 .../tcan_alias_generic.nim | 0 .../tcan_alias_specialised_generic.nim | 0 .../tcan_inherit_generic.nim | 0 .../tcan_specialise_generic.nim | 0 tests/{run => generics}/texplicitgeneric1.nim | 0 tests/{run => generics}/texplicitgeneric2.nim | 0 .../{compile => generics}/tforwardgeneric.nim | 0 .../tgeneric.nim => generics/tgeneric0.nim} | 0 .../tgenerics1.nim => generics/tgeneric1.nim} | 0 tests/{compile => generics}/tgeneric2.nim | 0 tests/{compile => generics}/tgeneric3.nim | 0 tests/{compile => generics}/tgeneric4.nim | 0 .../tgenericdefaults.nim | 0 .../{compile => generics}/tgenericmatcher.nim | 0 .../tgenericmatcher2.nim | 0 tests/{run => generics}/tgenericprocvar.nim | 0 tests/{compile => generics}/tgenericprop.nim | 0 tests/{compile => generics}/tgenericrefs.nim | 0 .../tgenericshardcases.nim | 0 tests/{compile => generics}/tgenerictmpl.nim | 0 .../{compile => generics}/tgenericvariant.nim | 0 .../tspecialised_is_equivalent.nim | 0 .../{compile => generics}/tthread_generic.nim | 0 .../{run => generics}/tvarargs_vs_generic.nim | 0 tests/{run => gensym}/tgensym.nim | 0 tests/{compile => gensym}/tgensymgeneric.nim | 0 tests/{run => global}/tglobal.nim | 0 tests/{compile => global}/tglobalforvar.nim | 0 tests/{run => ifstmt}/tnestif.nim | 0 .../{compile => implicit}/timplicititems.nim | 0 tests/{compile => implicit}/timplictderef.nim | 0 .../{run => important}/tdrdobbs_examples.nim | 0 tests/{reject => init}/tuninit1.nim | 0 tests/{run => init}/tzeroarray.nim | 0 tests/{run => iter}/tcountup.nim | 0 tests/{compile => iter}/titer.nim | 0 tests/{compile => iter}/titer2.nim | 0 tests/{run => iter}/titer3.nim | 0 tests/{reject => iter}/titer4.nim | 0 tests/{run => iter}/titer5.nim | 0 tests/{run => iter}/titer6.nim | 0 tests/{run => iter}/titer7.nim | 0 tests/{run => iter}/titer8.nim | 0 tests/{run => iter}/titer9.nim | 0 .../titer_no_tuple_unpack.nim | 0 tests/{compile => iter}/titerovl.nim | 0 tests/{run => iter}/titerslice.nim | 0 tests/{run => iter}/titervaropenarray.nim | 0 tests/{run => iter}/tmoditer.nim | 0 tests/{reject => iter}/treciter.nim | 0 tests/{reject => iter}/twrongiter.nim | 0 tests/{reject => let}/tlet.nim | 0 tests/{reject => let}/tlet2.nim | 0 tests/{run => lexer}/thexlit.nim | 0 tests/{compile => lexer}/thexrange.nim | 0 tests/{compile => lexer}/tident.nim | 0 tests/{reject => lexer}/tind1.nim | 0 tests/{run => lexer}/tindent1.nim | 0 tests/{compile => lexer}/tlexer.nim | 0 tests/{reject => lexer}/tmissingnl.nim | 0 tests/{run => lexer}/tstrlits.nim | 0 tests/{reject => lexer}/tunderscores.nim | 0 tests/{compile => lookup}/tredef.nim | 0 tests/{run => lookups}/tkoeniglookup.nim | 0 tests/{compile => macro}/tmacro1.nim | 0 tests/{run => macro}/tmacro2.nim | 0 tests/{run => macro}/tmacro3.nim | 0 tests/{run => macro}/tmacro4.nim | 0 .../tmacro2.nim => macro/tmacro5.nim} | 0 tests/{compile => macro}/tmacroaspragma.nim | 0 tests/{run => macro}/tmacrogenerics.nim | 0 tests/{run => macro}/tmacros1.nim | 0 tests/{compile => macro}/tmacrostmt.nim | 0 tests/{compile => macro}/tmacrotypes.nim | 0 .../tnimrodnode_for_runtime.nim | 0 tests/{run => macro}/tprintf.nim | 0 tests/{run => macro}/tquotewords.nim | 0 tests/{reject => macro}/trecmacro.nim | 0 tests/{run => macro}/tstringinterp.nim | 0 tests/{run => macro}/tvtable.nim | 0 tests/{compile => macros}/tdumpast.nim | 0 tests/{compile => macros}/tdumpast2.nim | 0 tests/{run => macros}/tdumptree.nim | 0 tests/{run => macros}/tidgen.nim | 0 tests/{run => magics}/tlowhigh.nim | 0 tests/{run => matrix}/tmatrix.nim | 0 tests/{compile => matrix}/tmatrix1.nim | 0 tests/{compile => matrix}/tmatrix2.nim | 0 tests/{compile => metatype}/tbindtypedesc.nim | 0 .../tcompositetypeclasses.nim | 0 tests/{compile => metatype}/tconstraints.nim | 0 tests/{run => metatype}/tsemistatic.nim | 0 tests/metatype/ttypebar.nim | 14 + tests/{compile => metatype}/ttypeclasses.nim | 0 tests/{run => metatype}/ttypedesc1.nim | 0 .../{compile => metatype}/ttypeselectors.nim | 0 tests/{run => metatype}/ttypetraits.nim | 0 tests/{run => metatype}/tusertypeclasses.nim | 0 tests/{run => metatype}/utypeclasses.nim | 0 tests/{run => method}/mmultim3.nim | 0 tests/{reject => method}/tmethod.nim | 0 tests/{run => method}/tmethods1.nim | 0 tests/{run => method}/tmultim1.nim | 0 tests/{run => method}/tmultim2.nim | 0 tests/{run => method}/tmultim3.nim | 0 tests/{run => method}/tmultim4.nim | 0 tests/{run => method}/tmultim6.nim | 0 tests/{run => method}/tsimmeth.nim | 0 tests/{reject => module}/mopaque.nim | 0 tests/{compile => module}/mrecmod.nim | 0 tests/{compile => module}/mrecmod2.nim | 0 tests/{reject => module}/topaque.nim | 0 tests/{reject => module}/trecinca.nim | 0 tests/{reject => module}/trecincb.nim | 0 tests/{compile => module}/trecmod.nim | 0 tests/{compile => module}/trecmod2.nim | 0 tests/{compile => modules}/mexporta.nim | 0 tests/{compile => modules}/mexportb.nim | 0 tests/{compile => modules}/texport.nim | 0 tests/{reject => modules}/timportexcept.nim | 0 .../{reject => namedparams}/tnamedparams.nim | 0 .../tnamedparams2.nim} | 0 tests/{reject => namspc}/mnamspc1.nim | 0 tests/{reject => namspc}/mnamspc2.nim | 0 tests/{reject => namspc}/tnamspc.nim | 0 tests/{reject => notnil}/tnotnil.nim | 0 tests/{reject => notnil}/tnotnil1.nim | 0 tests/{reject => notnil}/tnotnil2.nim | 0 tests/{run => object}/tobjconstr.nim | 0 tests/{compile => object}/tobjconstr2.nim | 0 tests/{compile => object}/tobjcov.nim | 0 tests/{run => object}/tobject.nim | 0 tests/{compile => object}/tobject2.nim | 0 tests/{compile => object}/tobject3.nim | 0 tests/{compile => object}/toop.nim | 0 tests/{run => object}/toop1.nim | 0 tests/{compile => objects}/tobjects.nim | 0 tests/{reject => objvariant}/tadrdisc.nim | 0 .../{reject => objvariant}/tcheckedfield1.nim | 0 .../{reject => objvariant}/temptycaseobj.nim | 0 tests/{run => objvariant}/tvariantstack.nim | 0 tests/{reject => openarray}/topena1.nim | 0 tests/{run => openarray}/topenarrayrepr.nim | 0 tests/{run => openarray}/topenlen.nim | 0 tests/{run => operator}/tofopr.nim | 0 tests/{run => operator}/toprprec.nim | 0 tests/{run => operator}/tprecedence.nim | 0 tests/{run => overflw}/toverflw.nim | 0 tests/{run => overflw}/toverflw2.nim | 0 tests/{run => overflw}/tovfint.nim | 0 tests/{reject => overload}/toverl.nim | 0 tests/{run => overload}/toverl2.nim | 0 tests/{run => overload}/toverl3.nim | 0 tests/{compile => overload}/toverprc.nim | 0 tests/{run => overload}/toverwr.nim | 0 tests/{run => pattern}/tpatterns.nim | 0 tests/{compile => pragma}/tuserpragma.nim | 0 tests/{compile => pragmas}/tpush.nim | 0 tests/{run => proc}/tnestprc.nim | 0 tests/{reject => proc}/tprocredef.nim | 0 .../{compile => procvar}/tgenericprocvar.nim | 0 tests/{reject => procvar}/tprocvar.nim | 0 .../tprocvar.nim => procvar/tprocvar2.nim} | 0 tests/{compile => procvar}/tprocvars.nim | 0 tests/{compile => range}/compilehelpers.nim | 0 tests/{run => range}/tbug499771.nim | 0 tests/{compile => range}/tcolors.nim | 0 tests/{compile => range}/tmatrix3.nim | 0 tests/{reject => range}/tsubrange.nim | 0 tests/{run => range}/tsubrange2.nim | 0 .../tsubrange.nim => range/tsubrange3.nim} | 0 tests/reject/99bottles.nim | 1 - tests/reject/t99bott.nim | 36 -- tests/reject/tatomic.nim | 12 - tests/reject/tgenconstraints.nim | 30 -- tests/reject/tinc.nim | 12 - tests/reject/tinout.nim | 16 - tests/reject/tinvalidarrayaccess.nim | 14 - tests/reject/tinvalidnewseq.nim | 27 -- tests/reject/tinvwhen.nim | 15 - tests/reject/tnoinst.nim | 16 - tests/reject/tnolen.nim | 9 - tests/reject/tnoop.nim | 12 - tests/reject/tnot.nim | 22 -- tests/reject/trawstr.nim | 12 - tests/reject/tsimtych.nim | 12 - tests/run/globalaux.nim | 15 - tests/run/globalaux2.nim | 4 - tests/run/minit.nim | 2 - tests/run/tack.nim | 21 -- tests/run/tbug511622.nim | 16 - tests/run/tdomulttest.nim | 17 - tests/run/temit.nim | 20 -- tests/run/teventemitter.nim | 33 -- tests/run/tevents.nim | 48 --- tests/run/tfilter.nim | 41 --- tests/run/thintoff.nim | 12 - tests/run/tinit.nim | 12 - tests/run/tints.nim | 45 --- tests/run/tlocals.nim | 11 - tests/run/tmemoization.nim | 17 - tests/run/tnewderef.nim | 11 - tests/run/tpos.nim | 35 -- tests/run/tromans.nim | 71 ---- tests/run/tsimplesort.nim | 313 ----------------- tests/run/tslices.nim | 59 ---- tests/run/tsortdev.nim | 59 ---- tests/run/tstrange.nim | 23 -- tests/run/tvarious1.nim | 41 --- tests/run/tvarnums.nim | 142 -------- tests/{compile => seq}/tseq2.nim | 0 tests/{run => seq}/tseqcon.nim | 0 tests/{compile => seq}/tseqcon2.nim | 0 tests/{run => seq}/tseqtuple.nim | 0 tests/{run => seq}/tsequtils.nim | 0 tests/{run => seq}/ttoseq.nim | 0 tests/{run => sets}/tsets.nim | 0 tests/{run => sets}/tsets2.nim | 0 tests/{run => static}/tstaticparams.nim | 0 tests/{compile => stdlib}/tcputime.nim | 0 tests/{run => stdlib}/tcritbits.nim | 0 tests/{compile => stdlib}/tdialogs.nim | 0 tests/{compile => stdlib}/techo.nim | 0 tests/{run => stdlib}/tformat.nim | 0 tests/{run => stdlib}/thashes.nim | 0 tests/{compile => stdlib}/tio.nim | 0 tests/{compile => stdlib}/tircbot.nim | 0 tests/{run => stdlib}/tlists.nim | 0 tests/{compile => stdlib}/tmarshal.nim | 0 tests/{run => stdlib}/tmath.nim | 0 .../{compile/tmath.nim => stdlib/tmath2.nim} | 0 tests/{compile => stdlib}/tmongo.nim | 0 tests/{compile => stdlib}/tos.nim | 0 tests/{compile => stdlib}/tparscfg.nim | 0 tests/{compile => stdlib}/tparsefloat.nim | 0 tests/{compile => stdlib}/tparsopt.nim | 0 tests/{run => stdlib}/tpegs.nim | 0 tests/{compile => stdlib}/tposix.nim | 0 tests/{compile => stdlib}/tquit.nim | 0 tests/{run => stdlib}/tregex.nim | 0 tests/{run => stdlib}/treguse.nim | 0 tests/{run => stdlib}/trepr.nim | 0 .../{compile/trepr.nim => stdlib/trepr2.nim} | 0 tests/{compile => stdlib}/tsockets.nim | 0 tests/{compile => stdlib}/tsortcall.nim | 0 tests/{run => stdlib}/tsplit.nim | 0 tests/{compile => stdlib}/tstreams.nim | 0 tests/{compile => stdlib}/tstrset.nim | 0 tests/{compile => stdlib}/tstrtabs.nim | 0 tests/{run => stdlib}/tstrutil.nim | 0 tests/{compile => stdlib}/ttime.nim | 0 tests/{run => stdlib}/tunidecode.nim | 0 tests/{compile => stdlib}/twalker.nim | 0 tests/{run => stdlib}/txmlgen.nim | 0 tests/{run => stdlib}/txmltree.nim | 0 tests/{compile => table}/ttableconstr.nim | 0 tests/{run => table}/ttables.nim | 0 tests/{run => table}/ttables2.nim | 0 .../mcan_access_hidden_field.nim | 0 tests/{compile => template}/mtempl5.nim | 0 .../tcan_access_hidden_field.nim | 0 .../{compile => template}/thygienictempl.nim | 0 tests/{compile => template}/tmodulealias.nim | 0 tests/{run => template}/tstempl.nim | 0 tests/{compile => template}/ttempl.nim | 0 tests/{reject => template}/ttempl2.nim | 0 tests/{compile => template}/ttempl3.nim | 0 tests/{compile => template}/ttempl4.nim | 0 tests/{compile => template}/ttempl5.nim | 0 .../ttemplreturntype.nim | 0 tests/{run => template}/utemplates.nim | 0 tests/testament/backend.nim | 120 +++++++ tests/testament/categories.nim | 256 ++++++++++++++ tests/testament/specs.nim | 130 +++++++ tests/testament/tester.nim | 267 +++++++++++++++ tests/{reject => trmacros}/tdisallowif.nim | 0 tests/{run => tuples}/tanontuples.nim | 0 .../{reject => tuples}/twrongtupleaccess.nim | 0 tests/{compile => typerel}/tcommontype.nim | 0 .../tno_int_in_bool_context.nim | 0 .../{compile => typerel}/tnoargopenarray.nim | 0 tests/{reject => typerel}/tnocontains.nim | 0 tests/{compile => typerel}/trectuple.nim | 0 tests/{compile => typerel}/trectuples.nim | 0 tests/{reject => typerel}/trectype.nim | 0 tests/{reject => typerel}/trefs.nim | 0 tests/{run => typerel}/trettypeinference.nim | 0 .../tsecondarrayproperty.nim | 0 tests/{compile => typerel}/ttuple1.nim | 0 .../{reject => typerel}/ttypelessemptyset.nim | 0 tests/{reject => typerel}/ttypenoval.nim | 0 tests/{reject => typerel}/ttypenovalue.nim | 0 tests/{compile => typerel}/tvoid.nim | 0 tests/{compile => typerel}/typalias.nim | 0 tests/{reject => typerel}/typredef.nim | 0 tests/{run => types}/tfinalobj.nim | 0 tests/{compile => types}/tforwty.nim | 0 tests/{compile => types}/tforwty2.nim | 0 .../tillegaltyperecursion.nim | 0 tests/{reject => types}/tillrec.nim | 0 tests/{compile => types}/tinheritref.nim | 0 tests/{compile => types}/tisop.nim | 0 tests/{run => types}/tisopr.nim | 0 tests/{run => usingstmt}/tusingstatement.nim | 0 tests/{reject => varres}/tvarres1.nim | 0 tests/{reject => varres}/tvarres2.nim | 0 .../{run/tvarres1.nim => varres/tvarres3.nim} | 0 .../{run/tvarres2.nim => varres/tvarres4.nim} | 0 tests/{run => varres}/tvartup.nim | 0 tests/{run => varstmt}/tlet.nim | 0 tests/{run => varstmt}/tvardecl.nim | 0 tests/{compile => vm}/tconsteval.nim | 0 tests/{compile => vm}/teval1.nim | 0 tests/{compile => vm}/tslurp.nim | 0 tests/{reject => vm}/twrongconst.nim | 0 481 files changed, 794 insertions(+), 2506 deletions(-) rename tests/{run => actiontable}/tactiontable.nim (100%) rename tests/{reject => actiontable}/tactiontable2.nim (100%) rename tests/{compile => alias}/talias.nim (100%) rename tests/{reject => ambsym}/mambsym1.nim (100%) rename tests/{reject => ambsym}/mambsym2.nim (100%) rename tests/{run => ambsym}/mambsys1.nim (100%) rename tests/{run => ambsym}/mambsys2.nim (100%) rename tests/{reject => ambsym}/tambsym.nim (100%) rename tests/{run => ambsym}/tambsym2.nim (100%) rename tests/{reject => ambsym}/tambsym3.nim (100%) rename tests/{run => ambsym}/tambsys.nim (100%) rename tests/{run => array}/tarray.nim (100%) rename tests/{run => array}/tarray2.nim (100%) rename tests/{run => array}/tarray3.nim (100%) rename tests/{reject => array}/tarraycons.nim (100%) rename tests/{run/tarraycons.nim => array/tarraycons2.nim} (100%) rename tests/{reject => array}/tarrayplus.nim (100%) rename tests/{compile => array}/tarrindx.nim (100%) rename tests/{run => assert}/tassert.nim (100%) rename tests/{run => assert}/tfailedassert.nim (100%) rename tests/{run => assert}/tunittests.nim (100%) rename tests/{run => assert}/tuserassert.nim (100%) rename tests/{compile => assign}/tassign.nim (100%) rename tests/{run => assign}/tcopy.nim (100%) rename tests/{run => assign}/tgenericassign.nim (100%) rename tests/{run => assign}/tgenericassigntuples.nim (100%) rename tests/{run => assign}/tobjasgn.nim (100%) rename tests/{run => assign}/tvariantasgn.nim (100%) rename tests/{run => astoverload}/tastoverload1.nim (100%) rename tests/{run => async}/tasynciossl.nim (100%) rename tests/{run => async}/tasyncudp.nim (100%) rename tests/{run => bind}/mbind3.nim (100%) rename tests/{run => bind}/tbind1.nim (100%) rename tests/{reject => bind}/tbind2.nim (100%) rename tests/{run => bind}/tbind3.nim (100%) rename tests/{compile => bind}/tbindoverload.nim (100%) rename tests/{reject => bind}/tbindtypedesc.nim (100%) rename tests/{compile => bind}/tdatabind.nim (100%) rename tests/{run => bind}/tmixin.nim (100%) rename tests/{reject => bind}/tnicerrorforsymchoice.nim (100%) rename tests/{reject => block}/tblock1.nim (100%) rename tests/{run => borrow}/tborrow.nim (100%) rename tests/{reject => borrow}/tinvalidborrow.nim (100%) rename tests/{run => casestmt}/tcase_setconstr.nim (100%) rename tests/{reject => casestmt}/tcaseexpr1.nim (100%) rename tests/{reject => casestmt}/tcaseoverlaprange.nim (100%) rename tests/{reject => casestmt}/tcaseoverlaprange2.nim (100%) rename tests/{run => casestmt}/tcasestm.nim (100%) rename tests/{compile => casestmt}/tcomputedgoto.nim (100%) rename tests/{compile => casestmt}/tlinearscanend.nim (100%) rename tests/{compile => ccgbugs}/tccgen1.nim (100%) rename tests/{run => ccgbugs}/tcgbug.nim (100%) rename tests/{compile => ccgbugs}/tcodegenbug1.nim (100%) rename tests/{run => closure}/tclosure.nim (100%) rename tests/{run => closure}/tclosure2.nim (100%) rename tests/{run => closure}/tclosure3.nim (100%) rename tests/{compile => closure}/tclosure4.nim (100%) rename tests/{compile => closure}/tclosurebug2.nim (100%) rename tests/{run => closure}/tinterf.nim (100%) rename tests/{reject => closure}/tinvalidclosure.nim (100%) rename tests/{reject => closure}/tinvalidclosure2.nim (100%) rename tests/{compile => closure}/tnamedparamanonproc.nim (100%) rename tests/{compile => closure}/tnestedproc.nim (100%) rename tests/{run => closure}/uclosures.nim (100%) rename tests/{run => cnstseq}/tcnstseq.nim (100%) rename tests/{run => cnstseq}/tcnstseq2.nim (100%) rename tests/{run => cnstseq}/tcnstseq3.nim (100%) delete mode 100644 tests/compile/mvarious.nim delete mode 100644 tests/compile/sunset.tmpl delete mode 100644 tests/compile/tambsym2.nim delete mode 100644 tests/compile/tcmdline.nim delete mode 100644 tests/compile/tcolonisproc.nim delete mode 100644 tests/compile/tdllvar.nim delete mode 100644 tests/compile/temptyecho.nim delete mode 100644 tests/compile/tendian.nim delete mode 100644 tests/compile/tfib.nim delete mode 100644 tests/compile/tgetstartmilsecs.nim delete mode 100644 tests/compile/tgtk.nim delete mode 100644 tests/compile/thallo.nim delete mode 100644 tests/compile/theaproots.nim delete mode 100644 tests/compile/tlastmod.nim delete mode 100644 tests/compile/tlibs.nim delete mode 100644 tests/compile/tloops.nim delete mode 100644 tests/compile/tmandelbrot.nim delete mode 100644 tests/compile/tnew.nim delete mode 100644 tests/compile/tnewlibs.nim delete mode 100644 tests/compile/tnewsets.nim delete mode 100644 tests/compile/tnewuns.nim delete mode 100644 tests/compile/tnoforward.nim delete mode 100644 tests/compile/tparedef.nim delete mode 100644 tests/compile/tprep.nim delete mode 100644 tests/compile/tquicksort.nim delete mode 100644 tests/compile/tradix.nim delete mode 100644 tests/compile/treadln.nim delete mode 100644 tests/compile/treadx.nim delete mode 100644 tests/compile/tshadow_magic_type.nim delete mode 100644 tests/compile/tsizeof.nim delete mode 100644 tests/compile/tstrace.nim delete mode 100644 tests/compile/tstrdesc.nim delete mode 100644 tests/compile/tstrdist.nim delete mode 100644 tests/compile/tvarious.nim rename tests/{compile => compiles}/tcompiles.nim (100%) rename tests/{run => concat}/tconcat.nim (100%) rename tests/{run => concurrency}/tnodeadlocks.nim (100%) rename tests/{reject => constr}/tconstr1.nim (100%) rename tests/{run => constr}/tconstr2.nim (100%) rename tests/{reject => constraints}/tconstraints.nim (100%) rename tests/{run => controlflow}/tcontinue.nim (100%) rename tests/{reject => controlflow}/tstatret.nim (100%) rename tests/{compile => converter}/tconvcolors.nim (100%) rename tests/{compile => converter}/tconvert.nim (100%) rename tests/{run => converter}/tgenericconverter.nim (100%) rename tests/{compile => converter}/ttypeconverter1.nim (100%) rename tests/{compile => defaultprocparam}/mdefaultprocparam.nim (100%) rename tests/{compile => defaultprocparam}/tdefaultprocparam.nim (100%) rename tests/{reject => deprecated}/tdeprecated.nim (100%) rename tests/{run => destructor}/tdestructor.nim (100%) rename tests/{reject/tdestructor.nim => destructor/tdestructor2.nim} (100%) rename tests/{compile => destructor}/tdictdestruct.nim (100%) rename tests/{compile => discard}/tdiscardable.nim (100%) rename tests/{reject => discard}/tneedsdiscard.nim (100%) rename tests/{run => distinct}/tcurrncy.nim (100%) rename tests/{reject => effects}/teffects1.nim (100%) rename tests/{reject => effects}/teffects2.nim (100%) rename tests/{reject => effects}/teffects3.nim (100%) rename tests/{reject => effects}/teffects4.nim (100%) rename tests/{reject => effects}/teffects5.nim (100%) rename tests/{compile/teffects1.nim => effects/teffects6.nim} (100%) rename tests/{reject => effects}/tsidee1.nim (100%) rename tests/{run => effects}/tsidee2.nim (100%) rename tests/{run => effects}/tsidee3.nim (100%) rename tests/{reject => effects}/tsidee4.nim (100%) rename tests/{compile => enum}/tenum.nim (100%) rename tests/{compile => enum}/tenum2.nim (100%) rename tests/{compile => enum}/tenum3.nim (100%) rename tests/{run => enum}/tenumhole.nim (100%) rename tests/{reject => enum}/tenumitems.nim (100%) rename tests/{run/tenumitems.nim => enum/tenumitems2.nim} (100%) rename tests/{reject => enum}/tenummix.nim (100%) rename tests/{run => enum}/tnamedenumfields.nim (100%) rename tests/{compile => enum}/toptions.nim (100%) rename tests/{run => exception}/tcontinuexc.nim (100%) rename tests/{run => exception}/texceptions.nim (100%) rename tests/{run => exception}/texcpt1.nim (100%) rename tests/{run => exception}/texcsub.nim (100%) rename tests/{run => exception}/tfinally.nim (100%) rename tests/{run => exception}/tfinally2.nim (100%) rename tests/{run => exception}/tfinally3.nim (100%) rename tests/{run => exception}/tonraise.nim (100%) rename tests/{run => exception}/treraise.nim (100%) rename tests/{run => exception}/tunhandledexc.nim (100%) rename tests/{run => exception}/twrongexc.nim (100%) rename tests/{reject => exprs}/texprstmt.nim (100%) rename tests/{reject => exprs}/tstmtexp.nim (100%) rename tests/{run => exprs}/tstmtexprs.nim (100%) rename tests/{run => fields}/tfieldindex.nim (100%) rename tests/{run => fields}/tfielditerator.nim (100%) rename tests/{run => fields}/tfielditerator2.nim (100%) rename tests/{run => float}/tfloat1.nim (100%) rename tests/{run => float}/tfloat2.nim (100%) rename tests/{run => float}/tfloat3.nim (100%) rename tests/{run => friends}/mfriends.nim (100%) rename tests/{run => friends}/tfriends.nim (100%) rename tests/{run => generics}/tbintre2.nim (100%) rename tests/{run => generics}/tbintree.nim (100%) rename tests/{compile => generics}/tcan_alias_generic.nim (100%) rename tests/{compile => generics}/tcan_alias_specialised_generic.nim (100%) rename tests/{compile => generics}/tcan_inherit_generic.nim (100%) rename tests/{compile => generics}/tcan_specialise_generic.nim (100%) rename tests/{run => generics}/texplicitgeneric1.nim (100%) rename tests/{run => generics}/texplicitgeneric2.nim (100%) rename tests/{compile => generics}/tforwardgeneric.nim (100%) rename tests/{compile/tgeneric.nim => generics/tgeneric0.nim} (100%) rename tests/{run/tgenerics1.nim => generics/tgeneric1.nim} (100%) rename tests/{compile => generics}/tgeneric2.nim (100%) rename tests/{compile => generics}/tgeneric3.nim (100%) rename tests/{compile => generics}/tgeneric4.nim (100%) rename tests/{compile => generics}/tgenericdefaults.nim (100%) rename tests/{compile => generics}/tgenericmatcher.nim (100%) rename tests/{compile => generics}/tgenericmatcher2.nim (100%) rename tests/{run => generics}/tgenericprocvar.nim (100%) rename tests/{compile => generics}/tgenericprop.nim (100%) rename tests/{compile => generics}/tgenericrefs.nim (100%) rename tests/{compile => generics}/tgenericshardcases.nim (100%) rename tests/{compile => generics}/tgenerictmpl.nim (100%) rename tests/{compile => generics}/tgenericvariant.nim (100%) rename tests/{compile => generics}/tspecialised_is_equivalent.nim (100%) rename tests/{compile => generics}/tthread_generic.nim (100%) rename tests/{run => generics}/tvarargs_vs_generic.nim (100%) rename tests/{run => gensym}/tgensym.nim (100%) rename tests/{compile => gensym}/tgensymgeneric.nim (100%) rename tests/{run => global}/tglobal.nim (100%) rename tests/{compile => global}/tglobalforvar.nim (100%) rename tests/{run => ifstmt}/tnestif.nim (100%) rename tests/{compile => implicit}/timplicititems.nim (100%) rename tests/{compile => implicit}/timplictderef.nim (100%) rename tests/{run => important}/tdrdobbs_examples.nim (100%) rename tests/{reject => init}/tuninit1.nim (100%) rename tests/{run => init}/tzeroarray.nim (100%) rename tests/{run => iter}/tcountup.nim (100%) rename tests/{compile => iter}/titer.nim (100%) rename tests/{compile => iter}/titer2.nim (100%) rename tests/{run => iter}/titer3.nim (100%) rename tests/{reject => iter}/titer4.nim (100%) rename tests/{run => iter}/titer5.nim (100%) rename tests/{run => iter}/titer6.nim (100%) rename tests/{run => iter}/titer7.nim (100%) rename tests/{run => iter}/titer8.nim (100%) rename tests/{run => iter}/titer9.nim (100%) rename tests/{compile => iter}/titer_no_tuple_unpack.nim (100%) rename tests/{compile => iter}/titerovl.nim (100%) rename tests/{run => iter}/titerslice.nim (100%) rename tests/{run => iter}/titervaropenarray.nim (100%) rename tests/{run => iter}/tmoditer.nim (100%) rename tests/{reject => iter}/treciter.nim (100%) rename tests/{reject => iter}/twrongiter.nim (100%) rename tests/{reject => let}/tlet.nim (100%) rename tests/{reject => let}/tlet2.nim (100%) rename tests/{run => lexer}/thexlit.nim (100%) rename tests/{compile => lexer}/thexrange.nim (100%) rename tests/{compile => lexer}/tident.nim (100%) rename tests/{reject => lexer}/tind1.nim (100%) rename tests/{run => lexer}/tindent1.nim (100%) rename tests/{compile => lexer}/tlexer.nim (100%) rename tests/{reject => lexer}/tmissingnl.nim (100%) rename tests/{run => lexer}/tstrlits.nim (100%) rename tests/{reject => lexer}/tunderscores.nim (100%) rename tests/{compile => lookup}/tredef.nim (100%) rename tests/{run => lookups}/tkoeniglookup.nim (100%) rename tests/{compile => macro}/tmacro1.nim (100%) rename tests/{run => macro}/tmacro2.nim (100%) rename tests/{run => macro}/tmacro3.nim (100%) rename tests/{run => macro}/tmacro4.nim (100%) rename tests/{compile/tmacro2.nim => macro/tmacro5.nim} (100%) rename tests/{compile => macro}/tmacroaspragma.nim (100%) rename tests/{run => macro}/tmacrogenerics.nim (100%) rename tests/{run => macro}/tmacros1.nim (100%) rename tests/{compile => macro}/tmacrostmt.nim (100%) rename tests/{compile => macro}/tmacrotypes.nim (100%) rename tests/{compile => macro}/tnimrodnode_for_runtime.nim (100%) rename tests/{run => macro}/tprintf.nim (100%) rename tests/{run => macro}/tquotewords.nim (100%) rename tests/{reject => macro}/trecmacro.nim (100%) rename tests/{run => macro}/tstringinterp.nim (100%) rename tests/{run => macro}/tvtable.nim (100%) rename tests/{compile => macros}/tdumpast.nim (100%) rename tests/{compile => macros}/tdumpast2.nim (100%) rename tests/{run => macros}/tdumptree.nim (100%) rename tests/{run => macros}/tidgen.nim (100%) rename tests/{run => magics}/tlowhigh.nim (100%) rename tests/{run => matrix}/tmatrix.nim (100%) rename tests/{compile => matrix}/tmatrix1.nim (100%) rename tests/{compile => matrix}/tmatrix2.nim (100%) rename tests/{compile => metatype}/tbindtypedesc.nim (100%) rename tests/{compile => metatype}/tcompositetypeclasses.nim (100%) rename tests/{compile => metatype}/tconstraints.nim (100%) rename tests/{run => metatype}/tsemistatic.nim (100%) create mode 100644 tests/metatype/ttypebar.nim rename tests/{compile => metatype}/ttypeclasses.nim (100%) rename tests/{run => metatype}/ttypedesc1.nim (100%) rename tests/{compile => metatype}/ttypeselectors.nim (100%) rename tests/{run => metatype}/ttypetraits.nim (100%) rename tests/{run => metatype}/tusertypeclasses.nim (100%) rename tests/{run => metatype}/utypeclasses.nim (100%) rename tests/{run => method}/mmultim3.nim (100%) rename tests/{reject => method}/tmethod.nim (100%) rename tests/{run => method}/tmethods1.nim (100%) rename tests/{run => method}/tmultim1.nim (100%) rename tests/{run => method}/tmultim2.nim (100%) rename tests/{run => method}/tmultim3.nim (100%) rename tests/{run => method}/tmultim4.nim (100%) rename tests/{run => method}/tmultim6.nim (100%) rename tests/{run => method}/tsimmeth.nim (100%) rename tests/{reject => module}/mopaque.nim (100%) rename tests/{compile => module}/mrecmod.nim (100%) rename tests/{compile => module}/mrecmod2.nim (100%) rename tests/{reject => module}/topaque.nim (100%) rename tests/{reject => module}/trecinca.nim (100%) rename tests/{reject => module}/trecincb.nim (100%) rename tests/{compile => module}/trecmod.nim (100%) rename tests/{compile => module}/trecmod2.nim (100%) rename tests/{compile => modules}/mexporta.nim (100%) rename tests/{compile => modules}/mexportb.nim (100%) rename tests/{compile => modules}/texport.nim (100%) rename tests/{reject => modules}/timportexcept.nim (100%) rename tests/{reject => namedparams}/tnamedparams.nim (100%) rename tests/{compile/tnamedparams.nim => namedparams/tnamedparams2.nim} (100%) rename tests/{reject => namspc}/mnamspc1.nim (100%) rename tests/{reject => namspc}/mnamspc2.nim (100%) rename tests/{reject => namspc}/tnamspc.nim (100%) rename tests/{reject => notnil}/tnotnil.nim (100%) rename tests/{reject => notnil}/tnotnil1.nim (100%) rename tests/{reject => notnil}/tnotnil2.nim (100%) rename tests/{run => object}/tobjconstr.nim (100%) rename tests/{compile => object}/tobjconstr2.nim (100%) rename tests/{compile => object}/tobjcov.nim (100%) rename tests/{run => object}/tobject.nim (100%) rename tests/{compile => object}/tobject2.nim (100%) rename tests/{compile => object}/tobject3.nim (100%) rename tests/{compile => object}/toop.nim (100%) rename tests/{run => object}/toop1.nim (100%) rename tests/{compile => objects}/tobjects.nim (100%) rename tests/{reject => objvariant}/tadrdisc.nim (100%) rename tests/{reject => objvariant}/tcheckedfield1.nim (100%) rename tests/{reject => objvariant}/temptycaseobj.nim (100%) rename tests/{run => objvariant}/tvariantstack.nim (100%) rename tests/{reject => openarray}/topena1.nim (100%) rename tests/{run => openarray}/topenarrayrepr.nim (100%) rename tests/{run => openarray}/topenlen.nim (100%) rename tests/{run => operator}/tofopr.nim (100%) rename tests/{run => operator}/toprprec.nim (100%) rename tests/{run => operator}/tprecedence.nim (100%) rename tests/{run => overflw}/toverflw.nim (100%) rename tests/{run => overflw}/toverflw2.nim (100%) rename tests/{run => overflw}/tovfint.nim (100%) rename tests/{reject => overload}/toverl.nim (100%) rename tests/{run => overload}/toverl2.nim (100%) rename tests/{run => overload}/toverl3.nim (100%) rename tests/{compile => overload}/toverprc.nim (100%) rename tests/{run => overload}/toverwr.nim (100%) rename tests/{run => pattern}/tpatterns.nim (100%) rename tests/{compile => pragma}/tuserpragma.nim (100%) rename tests/{compile => pragmas}/tpush.nim (100%) rename tests/{run => proc}/tnestprc.nim (100%) rename tests/{reject => proc}/tprocredef.nim (100%) rename tests/{compile => procvar}/tgenericprocvar.nim (100%) rename tests/{reject => procvar}/tprocvar.nim (100%) rename tests/{run/tprocvar.nim => procvar/tprocvar2.nim} (100%) rename tests/{compile => procvar}/tprocvars.nim (100%) rename tests/{compile => range}/compilehelpers.nim (100%) rename tests/{run => range}/tbug499771.nim (100%) rename tests/{compile => range}/tcolors.nim (100%) rename tests/{compile => range}/tmatrix3.nim (100%) rename tests/{reject => range}/tsubrange.nim (100%) rename tests/{run => range}/tsubrange2.nim (100%) rename tests/{run/tsubrange.nim => range/tsubrange3.nim} (100%) delete mode 100644 tests/reject/99bottles.nim delete mode 100644 tests/reject/t99bott.nim delete mode 100644 tests/reject/tatomic.nim delete mode 100644 tests/reject/tgenconstraints.nim delete mode 100644 tests/reject/tinc.nim delete mode 100644 tests/reject/tinout.nim delete mode 100644 tests/reject/tinvalidarrayaccess.nim delete mode 100644 tests/reject/tinvalidnewseq.nim delete mode 100644 tests/reject/tinvwhen.nim delete mode 100644 tests/reject/tnoinst.nim delete mode 100644 tests/reject/tnolen.nim delete mode 100644 tests/reject/tnoop.nim delete mode 100644 tests/reject/tnot.nim delete mode 100644 tests/reject/trawstr.nim delete mode 100644 tests/reject/tsimtych.nim delete mode 100644 tests/run/globalaux.nim delete mode 100644 tests/run/globalaux2.nim delete mode 100644 tests/run/minit.nim delete mode 100644 tests/run/tack.nim delete mode 100644 tests/run/tbug511622.nim delete mode 100644 tests/run/tdomulttest.nim delete mode 100644 tests/run/temit.nim delete mode 100644 tests/run/teventemitter.nim delete mode 100644 tests/run/tevents.nim delete mode 100644 tests/run/tfilter.nim delete mode 100644 tests/run/thintoff.nim delete mode 100644 tests/run/tinit.nim delete mode 100644 tests/run/tints.nim delete mode 100644 tests/run/tlocals.nim delete mode 100644 tests/run/tmemoization.nim delete mode 100644 tests/run/tnewderef.nim delete mode 100644 tests/run/tpos.nim delete mode 100644 tests/run/tromans.nim delete mode 100644 tests/run/tsimplesort.nim delete mode 100644 tests/run/tslices.nim delete mode 100644 tests/run/tsortdev.nim delete mode 100644 tests/run/tstrange.nim delete mode 100644 tests/run/tvarious1.nim delete mode 100644 tests/run/tvarnums.nim rename tests/{compile => seq}/tseq2.nim (100%) rename tests/{run => seq}/tseqcon.nim (100%) rename tests/{compile => seq}/tseqcon2.nim (100%) rename tests/{run => seq}/tseqtuple.nim (100%) rename tests/{run => seq}/tsequtils.nim (100%) rename tests/{run => seq}/ttoseq.nim (100%) rename tests/{run => sets}/tsets.nim (100%) rename tests/{run => sets}/tsets2.nim (100%) rename tests/{run => static}/tstaticparams.nim (100%) rename tests/{compile => stdlib}/tcputime.nim (100%) rename tests/{run => stdlib}/tcritbits.nim (100%) rename tests/{compile => stdlib}/tdialogs.nim (100%) rename tests/{compile => stdlib}/techo.nim (100%) rename tests/{run => stdlib}/tformat.nim (100%) rename tests/{run => stdlib}/thashes.nim (100%) rename tests/{compile => stdlib}/tio.nim (100%) rename tests/{compile => stdlib}/tircbot.nim (100%) rename tests/{run => stdlib}/tlists.nim (100%) rename tests/{compile => stdlib}/tmarshal.nim (100%) rename tests/{run => stdlib}/tmath.nim (100%) rename tests/{compile/tmath.nim => stdlib/tmath2.nim} (100%) rename tests/{compile => stdlib}/tmongo.nim (100%) rename tests/{compile => stdlib}/tos.nim (100%) rename tests/{compile => stdlib}/tparscfg.nim (100%) rename tests/{compile => stdlib}/tparsefloat.nim (100%) rename tests/{compile => stdlib}/tparsopt.nim (100%) rename tests/{run => stdlib}/tpegs.nim (100%) rename tests/{compile => stdlib}/tposix.nim (100%) rename tests/{compile => stdlib}/tquit.nim (100%) rename tests/{run => stdlib}/tregex.nim (100%) rename tests/{run => stdlib}/treguse.nim (100%) rename tests/{run => stdlib}/trepr.nim (100%) rename tests/{compile/trepr.nim => stdlib/trepr2.nim} (100%) rename tests/{compile => stdlib}/tsockets.nim (100%) rename tests/{compile => stdlib}/tsortcall.nim (100%) rename tests/{run => stdlib}/tsplit.nim (100%) rename tests/{compile => stdlib}/tstreams.nim (100%) rename tests/{compile => stdlib}/tstrset.nim (100%) rename tests/{compile => stdlib}/tstrtabs.nim (100%) rename tests/{run => stdlib}/tstrutil.nim (100%) rename tests/{compile => stdlib}/ttime.nim (100%) rename tests/{run => stdlib}/tunidecode.nim (100%) rename tests/{compile => stdlib}/twalker.nim (100%) rename tests/{run => stdlib}/txmlgen.nim (100%) rename tests/{run => stdlib}/txmltree.nim (100%) rename tests/{compile => table}/ttableconstr.nim (100%) rename tests/{run => table}/ttables.nim (100%) rename tests/{run => table}/ttables2.nim (100%) rename tests/{templates => template}/mcan_access_hidden_field.nim (100%) rename tests/{compile => template}/mtempl5.nim (100%) rename tests/{templates => template}/tcan_access_hidden_field.nim (100%) rename tests/{compile => template}/thygienictempl.nim (100%) rename tests/{compile => template}/tmodulealias.nim (100%) rename tests/{run => template}/tstempl.nim (100%) rename tests/{compile => template}/ttempl.nim (100%) rename tests/{reject => template}/ttempl2.nim (100%) rename tests/{compile => template}/ttempl3.nim (100%) rename tests/{compile => template}/ttempl4.nim (100%) rename tests/{compile => template}/ttempl5.nim (100%) rename tests/{compile => template}/ttemplreturntype.nim (100%) rename tests/{run => template}/utemplates.nim (100%) create mode 100644 tests/testament/backend.nim create mode 100644 tests/testament/categories.nim create mode 100644 tests/testament/specs.nim create mode 100644 tests/testament/tester.nim rename tests/{reject => trmacros}/tdisallowif.nim (100%) rename tests/{run => tuples}/tanontuples.nim (100%) rename tests/{reject => tuples}/twrongtupleaccess.nim (100%) rename tests/{compile => typerel}/tcommontype.nim (100%) rename tests/{reject => typerel}/tno_int_in_bool_context.nim (100%) rename tests/{compile => typerel}/tnoargopenarray.nim (100%) rename tests/{reject => typerel}/tnocontains.nim (100%) rename tests/{compile => typerel}/trectuple.nim (100%) rename tests/{compile => typerel}/trectuples.nim (100%) rename tests/{reject => typerel}/trectype.nim (100%) rename tests/{reject => typerel}/trefs.nim (100%) rename tests/{run => typerel}/trettypeinference.nim (100%) rename tests/{compile => typerel}/tsecondarrayproperty.nim (100%) rename tests/{compile => typerel}/ttuple1.nim (100%) rename tests/{reject => typerel}/ttypelessemptyset.nim (100%) rename tests/{reject => typerel}/ttypenoval.nim (100%) rename tests/{reject => typerel}/ttypenovalue.nim (100%) rename tests/{compile => typerel}/tvoid.nim (100%) rename tests/{compile => typerel}/typalias.nim (100%) rename tests/{reject => typerel}/typredef.nim (100%) rename tests/{run => types}/tfinalobj.nim (100%) rename tests/{compile => types}/tforwty.nim (100%) rename tests/{compile => types}/tforwty2.nim (100%) rename tests/{reject => types}/tillegaltyperecursion.nim (100%) rename tests/{reject => types}/tillrec.nim (100%) rename tests/{compile => types}/tinheritref.nim (100%) rename tests/{compile => types}/tisop.nim (100%) rename tests/{run => types}/tisopr.nim (100%) rename tests/{run => usingstmt}/tusingstatement.nim (100%) rename tests/{reject => varres}/tvarres1.nim (100%) rename tests/{reject => varres}/tvarres2.nim (100%) rename tests/{run/tvarres1.nim => varres/tvarres3.nim} (100%) rename tests/{run/tvarres2.nim => varres/tvarres4.nim} (100%) rename tests/{run => varres}/tvartup.nim (100%) rename tests/{run => varstmt}/tlet.nim (100%) rename tests/{run => varstmt}/tvardecl.nim (100%) rename tests/{compile => vm}/tconsteval.nim (100%) rename tests/{compile => vm}/teval1.nim (100%) rename tests/{compile => vm}/tslurp.nim (100%) rename tests/{reject => vm}/twrongconst.nim (100%) diff --git a/koch.nim b/koch.nim index 1b5c96b23..22e30ac5e 100644 --- a/koch.nim +++ b/koch.nim @@ -1,7 +1,7 @@ # # # Maintenance program for Nimrod -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -26,7 +26,7 @@ const +-----------------------------------------------------------------+ | Maintenance program for Nimrod | | Version $1| -| (c) 2013 Andreas Rumpf | +| (c) 2014 Andreas Rumpf | +-----------------------------------------------------------------+ Build time: $2, $3 @@ -268,6 +268,11 @@ proc tests(args: string) = exec(getCurrentDir() / "tests/tester".exe & " compile") exec(getCurrentDir() / "tests/tester".exe & " run") exec(getCurrentDir() / "tests/tester".exe & " merge") + when false: + # activate real soon: + exec("nimrod cc --taintMode:on tests/testament/tester") + exec(getCurrentDir() / "tests/testament/tester".exe & " all") + proc temp(args: string) = var output = "compiler" / "nimrod".exe diff --git a/tests/run/tactiontable.nim b/tests/actiontable/tactiontable.nim similarity index 100% rename from tests/run/tactiontable.nim rename to tests/actiontable/tactiontable.nim diff --git a/tests/reject/tactiontable2.nim b/tests/actiontable/tactiontable2.nim similarity index 100% rename from tests/reject/tactiontable2.nim rename to tests/actiontable/tactiontable2.nim diff --git a/tests/compile/talias.nim b/tests/alias/talias.nim similarity index 100% rename from tests/compile/talias.nim rename to tests/alias/talias.nim diff --git a/tests/reject/mambsym1.nim b/tests/ambsym/mambsym1.nim similarity index 100% rename from tests/reject/mambsym1.nim rename to tests/ambsym/mambsym1.nim diff --git a/tests/reject/mambsym2.nim b/tests/ambsym/mambsym2.nim similarity index 100% rename from tests/reject/mambsym2.nim rename to tests/ambsym/mambsym2.nim diff --git a/tests/run/mambsys1.nim b/tests/ambsym/mambsys1.nim similarity index 100% rename from tests/run/mambsys1.nim rename to tests/ambsym/mambsys1.nim diff --git a/tests/run/mambsys2.nim b/tests/ambsym/mambsys2.nim similarity index 100% rename from tests/run/mambsys2.nim rename to tests/ambsym/mambsys2.nim diff --git a/tests/reject/tambsym.nim b/tests/ambsym/tambsym.nim similarity index 100% rename from tests/reject/tambsym.nim rename to tests/ambsym/tambsym.nim diff --git a/tests/run/tambsym2.nim b/tests/ambsym/tambsym2.nim similarity index 100% rename from tests/run/tambsym2.nim rename to tests/ambsym/tambsym2.nim diff --git a/tests/reject/tambsym3.nim b/tests/ambsym/tambsym3.nim similarity index 100% rename from tests/reject/tambsym3.nim rename to tests/ambsym/tambsym3.nim diff --git a/tests/run/tambsys.nim b/tests/ambsym/tambsys.nim similarity index 100% rename from tests/run/tambsys.nim rename to tests/ambsym/tambsys.nim diff --git a/tests/run/tarray.nim b/tests/array/tarray.nim similarity index 100% rename from tests/run/tarray.nim rename to tests/array/tarray.nim diff --git a/tests/run/tarray2.nim b/tests/array/tarray2.nim similarity index 100% rename from tests/run/tarray2.nim rename to tests/array/tarray2.nim diff --git a/tests/run/tarray3.nim b/tests/array/tarray3.nim similarity index 100% rename from tests/run/tarray3.nim rename to tests/array/tarray3.nim diff --git a/tests/reject/tarraycons.nim b/tests/array/tarraycons.nim similarity index 100% rename from tests/reject/tarraycons.nim rename to tests/array/tarraycons.nim diff --git a/tests/run/tarraycons.nim b/tests/array/tarraycons2.nim similarity index 100% rename from tests/run/tarraycons.nim rename to tests/array/tarraycons2.nim diff --git a/tests/reject/tarrayplus.nim b/tests/array/tarrayplus.nim similarity index 100% rename from tests/reject/tarrayplus.nim rename to tests/array/tarrayplus.nim diff --git a/tests/compile/tarrindx.nim b/tests/array/tarrindx.nim similarity index 100% rename from tests/compile/tarrindx.nim rename to tests/array/tarrindx.nim diff --git a/tests/run/tassert.nim b/tests/assert/tassert.nim similarity index 100% rename from tests/run/tassert.nim rename to tests/assert/tassert.nim diff --git a/tests/run/tfailedassert.nim b/tests/assert/tfailedassert.nim similarity index 100% rename from tests/run/tfailedassert.nim rename to tests/assert/tfailedassert.nim diff --git a/tests/run/tunittests.nim b/tests/assert/tunittests.nim similarity index 100% rename from tests/run/tunittests.nim rename to tests/assert/tunittests.nim diff --git a/tests/run/tuserassert.nim b/tests/assert/tuserassert.nim similarity index 100% rename from tests/run/tuserassert.nim rename to tests/assert/tuserassert.nim diff --git a/tests/compile/tassign.nim b/tests/assign/tassign.nim similarity index 100% rename from tests/compile/tassign.nim rename to tests/assign/tassign.nim diff --git a/tests/run/tcopy.nim b/tests/assign/tcopy.nim similarity index 100% rename from tests/run/tcopy.nim rename to tests/assign/tcopy.nim diff --git a/tests/run/tgenericassign.nim b/tests/assign/tgenericassign.nim similarity index 100% rename from tests/run/tgenericassign.nim rename to tests/assign/tgenericassign.nim diff --git a/tests/run/tgenericassigntuples.nim b/tests/assign/tgenericassigntuples.nim similarity index 100% rename from tests/run/tgenericassigntuples.nim rename to tests/assign/tgenericassigntuples.nim diff --git a/tests/run/tobjasgn.nim b/tests/assign/tobjasgn.nim similarity index 100% rename from tests/run/tobjasgn.nim rename to tests/assign/tobjasgn.nim diff --git a/tests/run/tvariantasgn.nim b/tests/assign/tvariantasgn.nim similarity index 100% rename from tests/run/tvariantasgn.nim rename to tests/assign/tvariantasgn.nim diff --git a/tests/run/tastoverload1.nim b/tests/astoverload/tastoverload1.nim similarity index 100% rename from tests/run/tastoverload1.nim rename to tests/astoverload/tastoverload1.nim diff --git a/tests/run/tasynciossl.nim b/tests/async/tasynciossl.nim similarity index 100% rename from tests/run/tasynciossl.nim rename to tests/async/tasynciossl.nim diff --git a/tests/run/tasyncudp.nim b/tests/async/tasyncudp.nim similarity index 100% rename from tests/run/tasyncudp.nim rename to tests/async/tasyncudp.nim diff --git a/tests/run/mbind3.nim b/tests/bind/mbind3.nim similarity index 100% rename from tests/run/mbind3.nim rename to tests/bind/mbind3.nim diff --git a/tests/run/tbind1.nim b/tests/bind/tbind1.nim similarity index 100% rename from tests/run/tbind1.nim rename to tests/bind/tbind1.nim diff --git a/tests/reject/tbind2.nim b/tests/bind/tbind2.nim similarity index 100% rename from tests/reject/tbind2.nim rename to tests/bind/tbind2.nim diff --git a/tests/run/tbind3.nim b/tests/bind/tbind3.nim similarity index 100% rename from tests/run/tbind3.nim rename to tests/bind/tbind3.nim diff --git a/tests/compile/tbindoverload.nim b/tests/bind/tbindoverload.nim similarity index 100% rename from tests/compile/tbindoverload.nim rename to tests/bind/tbindoverload.nim diff --git a/tests/reject/tbindtypedesc.nim b/tests/bind/tbindtypedesc.nim similarity index 100% rename from tests/reject/tbindtypedesc.nim rename to tests/bind/tbindtypedesc.nim diff --git a/tests/compile/tdatabind.nim b/tests/bind/tdatabind.nim similarity index 100% rename from tests/compile/tdatabind.nim rename to tests/bind/tdatabind.nim diff --git a/tests/run/tmixin.nim b/tests/bind/tmixin.nim similarity index 100% rename from tests/run/tmixin.nim rename to tests/bind/tmixin.nim diff --git a/tests/reject/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim similarity index 100% rename from tests/reject/tnicerrorforsymchoice.nim rename to tests/bind/tnicerrorforsymchoice.nim diff --git a/tests/reject/tblock1.nim b/tests/block/tblock1.nim similarity index 100% rename from tests/reject/tblock1.nim rename to tests/block/tblock1.nim diff --git a/tests/run/tborrow.nim b/tests/borrow/tborrow.nim similarity index 100% rename from tests/run/tborrow.nim rename to tests/borrow/tborrow.nim diff --git a/tests/reject/tinvalidborrow.nim b/tests/borrow/tinvalidborrow.nim similarity index 100% rename from tests/reject/tinvalidborrow.nim rename to tests/borrow/tinvalidborrow.nim diff --git a/tests/run/tcase_setconstr.nim b/tests/casestmt/tcase_setconstr.nim similarity index 100% rename from tests/run/tcase_setconstr.nim rename to tests/casestmt/tcase_setconstr.nim diff --git a/tests/reject/tcaseexpr1.nim b/tests/casestmt/tcaseexpr1.nim similarity index 100% rename from tests/reject/tcaseexpr1.nim rename to tests/casestmt/tcaseexpr1.nim diff --git a/tests/reject/tcaseoverlaprange.nim b/tests/casestmt/tcaseoverlaprange.nim similarity index 100% rename from tests/reject/tcaseoverlaprange.nim rename to tests/casestmt/tcaseoverlaprange.nim diff --git a/tests/reject/tcaseoverlaprange2.nim b/tests/casestmt/tcaseoverlaprange2.nim similarity index 100% rename from tests/reject/tcaseoverlaprange2.nim rename to tests/casestmt/tcaseoverlaprange2.nim diff --git a/tests/run/tcasestm.nim b/tests/casestmt/tcasestm.nim similarity index 100% rename from tests/run/tcasestm.nim rename to tests/casestmt/tcasestm.nim diff --git a/tests/compile/tcomputedgoto.nim b/tests/casestmt/tcomputedgoto.nim similarity index 100% rename from tests/compile/tcomputedgoto.nim rename to tests/casestmt/tcomputedgoto.nim diff --git a/tests/compile/tlinearscanend.nim b/tests/casestmt/tlinearscanend.nim similarity index 100% rename from tests/compile/tlinearscanend.nim rename to tests/casestmt/tlinearscanend.nim diff --git a/tests/compile/tccgen1.nim b/tests/ccgbugs/tccgen1.nim similarity index 100% rename from tests/compile/tccgen1.nim rename to tests/ccgbugs/tccgen1.nim diff --git a/tests/run/tcgbug.nim b/tests/ccgbugs/tcgbug.nim similarity index 100% rename from tests/run/tcgbug.nim rename to tests/ccgbugs/tcgbug.nim diff --git a/tests/compile/tcodegenbug1.nim b/tests/ccgbugs/tcodegenbug1.nim similarity index 100% rename from tests/compile/tcodegenbug1.nim rename to tests/ccgbugs/tcodegenbug1.nim diff --git a/tests/run/tclosure.nim b/tests/closure/tclosure.nim similarity index 100% rename from tests/run/tclosure.nim rename to tests/closure/tclosure.nim diff --git a/tests/run/tclosure2.nim b/tests/closure/tclosure2.nim similarity index 100% rename from tests/run/tclosure2.nim rename to tests/closure/tclosure2.nim diff --git a/tests/run/tclosure3.nim b/tests/closure/tclosure3.nim similarity index 100% rename from tests/run/tclosure3.nim rename to tests/closure/tclosure3.nim diff --git a/tests/compile/tclosure4.nim b/tests/closure/tclosure4.nim similarity index 100% rename from tests/compile/tclosure4.nim rename to tests/closure/tclosure4.nim diff --git a/tests/compile/tclosurebug2.nim b/tests/closure/tclosurebug2.nim similarity index 100% rename from tests/compile/tclosurebug2.nim rename to tests/closure/tclosurebug2.nim diff --git a/tests/run/tinterf.nim b/tests/closure/tinterf.nim similarity index 100% rename from tests/run/tinterf.nim rename to tests/closure/tinterf.nim diff --git a/tests/reject/tinvalidclosure.nim b/tests/closure/tinvalidclosure.nim similarity index 100% rename from tests/reject/tinvalidclosure.nim rename to tests/closure/tinvalidclosure.nim diff --git a/tests/reject/tinvalidclosure2.nim b/tests/closure/tinvalidclosure2.nim similarity index 100% rename from tests/reject/tinvalidclosure2.nim rename to tests/closure/tinvalidclosure2.nim diff --git a/tests/compile/tnamedparamanonproc.nim b/tests/closure/tnamedparamanonproc.nim similarity index 100% rename from tests/compile/tnamedparamanonproc.nim rename to tests/closure/tnamedparamanonproc.nim diff --git a/tests/compile/tnestedproc.nim b/tests/closure/tnestedproc.nim similarity index 100% rename from tests/compile/tnestedproc.nim rename to tests/closure/tnestedproc.nim diff --git a/tests/run/uclosures.nim b/tests/closure/uclosures.nim similarity index 100% rename from tests/run/uclosures.nim rename to tests/closure/uclosures.nim diff --git a/tests/run/tcnstseq.nim b/tests/cnstseq/tcnstseq.nim similarity index 100% rename from tests/run/tcnstseq.nim rename to tests/cnstseq/tcnstseq.nim diff --git a/tests/run/tcnstseq2.nim b/tests/cnstseq/tcnstseq2.nim similarity index 100% rename from tests/run/tcnstseq2.nim rename to tests/cnstseq/tcnstseq2.nim diff --git a/tests/run/tcnstseq3.nim b/tests/cnstseq/tcnstseq3.nim similarity index 100% rename from tests/run/tcnstseq3.nim rename to 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 = "" - - - - - Nimrod Programming System - - - - - -
- - -
- -
-
-
-

latest news

-
-
- $ticker -
-
-
-
-

additional links

-
- -
-
-
- $content -
-
- -
- - 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/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/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 f6f939769..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 similarity index 100% rename from tests/compile/tcompiles.nim rename to tests/compiles/tcompiles.nim diff --git a/tests/run/tconcat.nim b/tests/concat/tconcat.nim similarity index 100% rename from tests/run/tconcat.nim rename to tests/concat/tconcat.nim diff --git a/tests/run/tnodeadlocks.nim b/tests/concurrency/tnodeadlocks.nim similarity index 100% rename from tests/run/tnodeadlocks.nim rename to tests/concurrency/tnodeadlocks.nim diff --git a/tests/reject/tconstr1.nim b/tests/constr/tconstr1.nim similarity index 100% rename from tests/reject/tconstr1.nim rename to tests/constr/tconstr1.nim diff --git a/tests/run/tconstr2.nim b/tests/constr/tconstr2.nim similarity index 100% rename from tests/run/tconstr2.nim rename to tests/constr/tconstr2.nim diff --git a/tests/reject/tconstraints.nim b/tests/constraints/tconstraints.nim similarity index 100% rename from tests/reject/tconstraints.nim rename to tests/constraints/tconstraints.nim diff --git a/tests/run/tcontinue.nim b/tests/controlflow/tcontinue.nim similarity index 100% rename from tests/run/tcontinue.nim rename to tests/controlflow/tcontinue.nim diff --git a/tests/reject/tstatret.nim b/tests/controlflow/tstatret.nim similarity index 100% rename from tests/reject/tstatret.nim rename to tests/controlflow/tstatret.nim diff --git a/tests/compile/tconvcolors.nim b/tests/converter/tconvcolors.nim similarity index 100% rename from tests/compile/tconvcolors.nim rename to tests/converter/tconvcolors.nim diff --git a/tests/compile/tconvert.nim b/tests/converter/tconvert.nim similarity index 100% rename from tests/compile/tconvert.nim rename to tests/converter/tconvert.nim diff --git a/tests/run/tgenericconverter.nim b/tests/converter/tgenericconverter.nim similarity index 100% rename from tests/run/tgenericconverter.nim rename to tests/converter/tgenericconverter.nim diff --git a/tests/compile/ttypeconverter1.nim b/tests/converter/ttypeconverter1.nim similarity index 100% rename from tests/compile/ttypeconverter1.nim rename to tests/converter/ttypeconverter1.nim diff --git a/tests/compile/mdefaultprocparam.nim b/tests/defaultprocparam/mdefaultprocparam.nim similarity index 100% rename from tests/compile/mdefaultprocparam.nim rename to tests/defaultprocparam/mdefaultprocparam.nim diff --git a/tests/compile/tdefaultprocparam.nim b/tests/defaultprocparam/tdefaultprocparam.nim similarity index 100% rename from tests/compile/tdefaultprocparam.nim rename to tests/defaultprocparam/tdefaultprocparam.nim diff --git a/tests/reject/tdeprecated.nim b/tests/deprecated/tdeprecated.nim similarity index 100% rename from tests/reject/tdeprecated.nim rename to tests/deprecated/tdeprecated.nim diff --git a/tests/run/tdestructor.nim b/tests/destructor/tdestructor.nim similarity index 100% rename from tests/run/tdestructor.nim rename to tests/destructor/tdestructor.nim diff --git a/tests/reject/tdestructor.nim b/tests/destructor/tdestructor2.nim similarity index 100% rename from tests/reject/tdestructor.nim rename to tests/destructor/tdestructor2.nim diff --git a/tests/compile/tdictdestruct.nim b/tests/destructor/tdictdestruct.nim similarity index 100% rename from tests/compile/tdictdestruct.nim rename to tests/destructor/tdictdestruct.nim diff --git a/tests/compile/tdiscardable.nim b/tests/discard/tdiscardable.nim similarity index 100% rename from tests/compile/tdiscardable.nim rename to tests/discard/tdiscardable.nim diff --git a/tests/reject/tneedsdiscard.nim b/tests/discard/tneedsdiscard.nim similarity index 100% rename from tests/reject/tneedsdiscard.nim rename to tests/discard/tneedsdiscard.nim diff --git a/tests/run/tcurrncy.nim b/tests/distinct/tcurrncy.nim similarity index 100% rename from tests/run/tcurrncy.nim rename to tests/distinct/tcurrncy.nim diff --git a/tests/reject/teffects1.nim b/tests/effects/teffects1.nim similarity index 100% rename from tests/reject/teffects1.nim rename to tests/effects/teffects1.nim diff --git a/tests/reject/teffects2.nim b/tests/effects/teffects2.nim similarity index 100% rename from tests/reject/teffects2.nim rename to tests/effects/teffects2.nim diff --git a/tests/reject/teffects3.nim b/tests/effects/teffects3.nim similarity index 100% rename from tests/reject/teffects3.nim rename to tests/effects/teffects3.nim diff --git a/tests/reject/teffects4.nim b/tests/effects/teffects4.nim similarity index 100% rename from tests/reject/teffects4.nim rename to tests/effects/teffects4.nim diff --git a/tests/reject/teffects5.nim b/tests/effects/teffects5.nim similarity index 100% rename from tests/reject/teffects5.nim rename to tests/effects/teffects5.nim diff --git a/tests/compile/teffects1.nim b/tests/effects/teffects6.nim similarity index 100% rename from tests/compile/teffects1.nim rename to tests/effects/teffects6.nim diff --git a/tests/reject/tsidee1.nim b/tests/effects/tsidee1.nim similarity index 100% rename from tests/reject/tsidee1.nim rename to tests/effects/tsidee1.nim diff --git a/tests/run/tsidee2.nim b/tests/effects/tsidee2.nim similarity index 100% rename from tests/run/tsidee2.nim rename to tests/effects/tsidee2.nim diff --git a/tests/run/tsidee3.nim b/tests/effects/tsidee3.nim similarity index 100% rename from tests/run/tsidee3.nim rename to tests/effects/tsidee3.nim diff --git a/tests/reject/tsidee4.nim b/tests/effects/tsidee4.nim similarity index 100% rename from tests/reject/tsidee4.nim rename to tests/effects/tsidee4.nim diff --git a/tests/compile/tenum.nim b/tests/enum/tenum.nim similarity index 100% rename from tests/compile/tenum.nim rename to tests/enum/tenum.nim diff --git a/tests/compile/tenum2.nim b/tests/enum/tenum2.nim similarity index 100% rename from tests/compile/tenum2.nim rename to tests/enum/tenum2.nim diff --git a/tests/compile/tenum3.nim b/tests/enum/tenum3.nim similarity index 100% rename from tests/compile/tenum3.nim rename to tests/enum/tenum3.nim diff --git a/tests/run/tenumhole.nim b/tests/enum/tenumhole.nim similarity index 100% rename from tests/run/tenumhole.nim rename to tests/enum/tenumhole.nim diff --git a/tests/reject/tenumitems.nim b/tests/enum/tenumitems.nim similarity index 100% rename from tests/reject/tenumitems.nim rename to tests/enum/tenumitems.nim diff --git a/tests/run/tenumitems.nim b/tests/enum/tenumitems2.nim similarity index 100% rename from tests/run/tenumitems.nim rename to tests/enum/tenumitems2.nim diff --git a/tests/reject/tenummix.nim b/tests/enum/tenummix.nim similarity index 100% rename from tests/reject/tenummix.nim rename to tests/enum/tenummix.nim diff --git a/tests/run/tnamedenumfields.nim b/tests/enum/tnamedenumfields.nim similarity index 100% rename from tests/run/tnamedenumfields.nim rename to tests/enum/tnamedenumfields.nim diff --git a/tests/compile/toptions.nim b/tests/enum/toptions.nim similarity index 100% rename from tests/compile/toptions.nim rename to tests/enum/toptions.nim diff --git a/tests/run/tcontinuexc.nim b/tests/exception/tcontinuexc.nim similarity index 100% rename from tests/run/tcontinuexc.nim rename to tests/exception/tcontinuexc.nim diff --git a/tests/run/texceptions.nim b/tests/exception/texceptions.nim similarity index 100% rename from tests/run/texceptions.nim rename to tests/exception/texceptions.nim diff --git a/tests/run/texcpt1.nim b/tests/exception/texcpt1.nim similarity index 100% rename from tests/run/texcpt1.nim rename to tests/exception/texcpt1.nim diff --git a/tests/run/texcsub.nim b/tests/exception/texcsub.nim similarity index 100% rename from tests/run/texcsub.nim rename to tests/exception/texcsub.nim diff --git a/tests/run/tfinally.nim b/tests/exception/tfinally.nim similarity index 100% rename from tests/run/tfinally.nim rename to tests/exception/tfinally.nim diff --git a/tests/run/tfinally2.nim b/tests/exception/tfinally2.nim similarity index 100% rename from tests/run/tfinally2.nim rename to tests/exception/tfinally2.nim diff --git a/tests/run/tfinally3.nim b/tests/exception/tfinally3.nim similarity index 100% rename from tests/run/tfinally3.nim rename to tests/exception/tfinally3.nim diff --git a/tests/run/tonraise.nim b/tests/exception/tonraise.nim similarity index 100% rename from tests/run/tonraise.nim rename to tests/exception/tonraise.nim diff --git a/tests/run/treraise.nim b/tests/exception/treraise.nim similarity index 100% rename from tests/run/treraise.nim rename to tests/exception/treraise.nim diff --git a/tests/run/tunhandledexc.nim b/tests/exception/tunhandledexc.nim similarity index 100% rename from tests/run/tunhandledexc.nim rename to tests/exception/tunhandledexc.nim diff --git a/tests/run/twrongexc.nim b/tests/exception/twrongexc.nim similarity index 100% rename from tests/run/twrongexc.nim rename to tests/exception/twrongexc.nim diff --git a/tests/reject/texprstmt.nim b/tests/exprs/texprstmt.nim similarity index 100% rename from tests/reject/texprstmt.nim rename to tests/exprs/texprstmt.nim diff --git a/tests/reject/tstmtexp.nim b/tests/exprs/tstmtexp.nim similarity index 100% rename from tests/reject/tstmtexp.nim rename to tests/exprs/tstmtexp.nim diff --git a/tests/run/tstmtexprs.nim b/tests/exprs/tstmtexprs.nim similarity index 100% rename from tests/run/tstmtexprs.nim rename to tests/exprs/tstmtexprs.nim diff --git a/tests/run/tfieldindex.nim b/tests/fields/tfieldindex.nim similarity index 100% rename from tests/run/tfieldindex.nim rename to tests/fields/tfieldindex.nim diff --git a/tests/run/tfielditerator.nim b/tests/fields/tfielditerator.nim similarity index 100% rename from tests/run/tfielditerator.nim rename to tests/fields/tfielditerator.nim diff --git a/tests/run/tfielditerator2.nim b/tests/fields/tfielditerator2.nim similarity index 100% rename from tests/run/tfielditerator2.nim rename to tests/fields/tfielditerator2.nim diff --git a/tests/run/tfloat1.nim b/tests/float/tfloat1.nim similarity index 100% rename from tests/run/tfloat1.nim rename to tests/float/tfloat1.nim diff --git a/tests/run/tfloat2.nim b/tests/float/tfloat2.nim similarity index 100% rename from tests/run/tfloat2.nim rename to tests/float/tfloat2.nim diff --git a/tests/run/tfloat3.nim b/tests/float/tfloat3.nim similarity index 100% rename from tests/run/tfloat3.nim rename to tests/float/tfloat3.nim diff --git a/tests/run/mfriends.nim b/tests/friends/mfriends.nim similarity index 100% rename from tests/run/mfriends.nim rename to tests/friends/mfriends.nim diff --git a/tests/run/tfriends.nim b/tests/friends/tfriends.nim similarity index 100% rename from tests/run/tfriends.nim rename to tests/friends/tfriends.nim diff --git a/tests/run/tbintre2.nim b/tests/generics/tbintre2.nim similarity index 100% rename from tests/run/tbintre2.nim rename to tests/generics/tbintre2.nim diff --git a/tests/run/tbintree.nim b/tests/generics/tbintree.nim similarity index 100% rename from tests/run/tbintree.nim rename to tests/generics/tbintree.nim diff --git a/tests/compile/tcan_alias_generic.nim b/tests/generics/tcan_alias_generic.nim similarity index 100% rename from tests/compile/tcan_alias_generic.nim rename to tests/generics/tcan_alias_generic.nim diff --git a/tests/compile/tcan_alias_specialised_generic.nim b/tests/generics/tcan_alias_specialised_generic.nim similarity index 100% rename from tests/compile/tcan_alias_specialised_generic.nim rename to tests/generics/tcan_alias_specialised_generic.nim diff --git a/tests/compile/tcan_inherit_generic.nim b/tests/generics/tcan_inherit_generic.nim similarity index 100% rename from tests/compile/tcan_inherit_generic.nim rename to tests/generics/tcan_inherit_generic.nim diff --git a/tests/compile/tcan_specialise_generic.nim b/tests/generics/tcan_specialise_generic.nim similarity index 100% rename from tests/compile/tcan_specialise_generic.nim rename to tests/generics/tcan_specialise_generic.nim diff --git a/tests/run/texplicitgeneric1.nim b/tests/generics/texplicitgeneric1.nim similarity index 100% rename from tests/run/texplicitgeneric1.nim rename to tests/generics/texplicitgeneric1.nim diff --git a/tests/run/texplicitgeneric2.nim b/tests/generics/texplicitgeneric2.nim similarity index 100% rename from tests/run/texplicitgeneric2.nim rename to tests/generics/texplicitgeneric2.nim diff --git a/tests/compile/tforwardgeneric.nim b/tests/generics/tforwardgeneric.nim similarity index 100% rename from tests/compile/tforwardgeneric.nim rename to tests/generics/tforwardgeneric.nim diff --git a/tests/compile/tgeneric.nim b/tests/generics/tgeneric0.nim similarity index 100% rename from tests/compile/tgeneric.nim rename to tests/generics/tgeneric0.nim diff --git a/tests/run/tgenerics1.nim b/tests/generics/tgeneric1.nim similarity index 100% rename from tests/run/tgenerics1.nim rename to tests/generics/tgeneric1.nim diff --git a/tests/compile/tgeneric2.nim b/tests/generics/tgeneric2.nim similarity index 100% rename from tests/compile/tgeneric2.nim rename to tests/generics/tgeneric2.nim diff --git a/tests/compile/tgeneric3.nim b/tests/generics/tgeneric3.nim similarity index 100% rename from tests/compile/tgeneric3.nim rename to tests/generics/tgeneric3.nim diff --git a/tests/compile/tgeneric4.nim b/tests/generics/tgeneric4.nim similarity index 100% rename from tests/compile/tgeneric4.nim rename to tests/generics/tgeneric4.nim diff --git a/tests/compile/tgenericdefaults.nim b/tests/generics/tgenericdefaults.nim similarity index 100% rename from tests/compile/tgenericdefaults.nim rename to tests/generics/tgenericdefaults.nim diff --git a/tests/compile/tgenericmatcher.nim b/tests/generics/tgenericmatcher.nim similarity index 100% rename from tests/compile/tgenericmatcher.nim rename to tests/generics/tgenericmatcher.nim diff --git a/tests/compile/tgenericmatcher2.nim b/tests/generics/tgenericmatcher2.nim similarity index 100% rename from tests/compile/tgenericmatcher2.nim rename to tests/generics/tgenericmatcher2.nim diff --git a/tests/run/tgenericprocvar.nim b/tests/generics/tgenericprocvar.nim similarity index 100% rename from tests/run/tgenericprocvar.nim rename to tests/generics/tgenericprocvar.nim diff --git a/tests/compile/tgenericprop.nim b/tests/generics/tgenericprop.nim similarity index 100% rename from tests/compile/tgenericprop.nim rename to tests/generics/tgenericprop.nim diff --git a/tests/compile/tgenericrefs.nim b/tests/generics/tgenericrefs.nim similarity index 100% rename from tests/compile/tgenericrefs.nim rename to tests/generics/tgenericrefs.nim diff --git a/tests/compile/tgenericshardcases.nim b/tests/generics/tgenericshardcases.nim similarity index 100% rename from tests/compile/tgenericshardcases.nim rename to tests/generics/tgenericshardcases.nim diff --git a/tests/compile/tgenerictmpl.nim b/tests/generics/tgenerictmpl.nim similarity index 100% rename from tests/compile/tgenerictmpl.nim rename to tests/generics/tgenerictmpl.nim diff --git a/tests/compile/tgenericvariant.nim b/tests/generics/tgenericvariant.nim similarity index 100% rename from tests/compile/tgenericvariant.nim rename to tests/generics/tgenericvariant.nim diff --git a/tests/compile/tspecialised_is_equivalent.nim b/tests/generics/tspecialised_is_equivalent.nim similarity index 100% rename from tests/compile/tspecialised_is_equivalent.nim rename to tests/generics/tspecialised_is_equivalent.nim diff --git a/tests/compile/tthread_generic.nim b/tests/generics/tthread_generic.nim similarity index 100% rename from tests/compile/tthread_generic.nim rename to tests/generics/tthread_generic.nim diff --git a/tests/run/tvarargs_vs_generic.nim b/tests/generics/tvarargs_vs_generic.nim similarity index 100% rename from tests/run/tvarargs_vs_generic.nim rename to tests/generics/tvarargs_vs_generic.nim diff --git a/tests/run/tgensym.nim b/tests/gensym/tgensym.nim similarity index 100% rename from tests/run/tgensym.nim rename to tests/gensym/tgensym.nim diff --git a/tests/compile/tgensymgeneric.nim b/tests/gensym/tgensymgeneric.nim similarity index 100% rename from tests/compile/tgensymgeneric.nim rename to tests/gensym/tgensymgeneric.nim diff --git a/tests/run/tglobal.nim b/tests/global/tglobal.nim similarity index 100% rename from tests/run/tglobal.nim rename to tests/global/tglobal.nim diff --git a/tests/compile/tglobalforvar.nim b/tests/global/tglobalforvar.nim similarity index 100% rename from tests/compile/tglobalforvar.nim rename to tests/global/tglobalforvar.nim diff --git a/tests/run/tnestif.nim b/tests/ifstmt/tnestif.nim similarity index 100% rename from tests/run/tnestif.nim rename to tests/ifstmt/tnestif.nim diff --git a/tests/compile/timplicititems.nim b/tests/implicit/timplicititems.nim similarity index 100% rename from tests/compile/timplicititems.nim rename to tests/implicit/timplicititems.nim diff --git a/tests/compile/timplictderef.nim b/tests/implicit/timplictderef.nim similarity index 100% rename from tests/compile/timplictderef.nim rename to tests/implicit/timplictderef.nim diff --git a/tests/run/tdrdobbs_examples.nim b/tests/important/tdrdobbs_examples.nim similarity index 100% rename from tests/run/tdrdobbs_examples.nim rename to tests/important/tdrdobbs_examples.nim diff --git a/tests/reject/tuninit1.nim b/tests/init/tuninit1.nim similarity index 100% rename from tests/reject/tuninit1.nim rename to tests/init/tuninit1.nim diff --git a/tests/run/tzeroarray.nim b/tests/init/tzeroarray.nim similarity index 100% rename from tests/run/tzeroarray.nim rename to tests/init/tzeroarray.nim diff --git a/tests/run/tcountup.nim b/tests/iter/tcountup.nim similarity index 100% rename from tests/run/tcountup.nim rename to tests/iter/tcountup.nim diff --git a/tests/compile/titer.nim b/tests/iter/titer.nim similarity index 100% rename from tests/compile/titer.nim rename to tests/iter/titer.nim diff --git a/tests/compile/titer2.nim b/tests/iter/titer2.nim similarity index 100% rename from tests/compile/titer2.nim rename to tests/iter/titer2.nim diff --git a/tests/run/titer3.nim b/tests/iter/titer3.nim similarity index 100% rename from tests/run/titer3.nim rename to tests/iter/titer3.nim diff --git a/tests/reject/titer4.nim b/tests/iter/titer4.nim similarity index 100% rename from tests/reject/titer4.nim rename to tests/iter/titer4.nim diff --git a/tests/run/titer5.nim b/tests/iter/titer5.nim similarity index 100% rename from tests/run/titer5.nim rename to tests/iter/titer5.nim diff --git a/tests/run/titer6.nim b/tests/iter/titer6.nim similarity index 100% rename from tests/run/titer6.nim rename to tests/iter/titer6.nim diff --git a/tests/run/titer7.nim b/tests/iter/titer7.nim similarity index 100% rename from tests/run/titer7.nim rename to tests/iter/titer7.nim diff --git a/tests/run/titer8.nim b/tests/iter/titer8.nim similarity index 100% rename from tests/run/titer8.nim rename to tests/iter/titer8.nim diff --git a/tests/run/titer9.nim b/tests/iter/titer9.nim similarity index 100% rename from tests/run/titer9.nim rename to tests/iter/titer9.nim diff --git a/tests/compile/titer_no_tuple_unpack.nim b/tests/iter/titer_no_tuple_unpack.nim similarity index 100% rename from tests/compile/titer_no_tuple_unpack.nim rename to tests/iter/titer_no_tuple_unpack.nim diff --git a/tests/compile/titerovl.nim b/tests/iter/titerovl.nim similarity index 100% rename from tests/compile/titerovl.nim rename to tests/iter/titerovl.nim diff --git a/tests/run/titerslice.nim b/tests/iter/titerslice.nim similarity index 100% rename from tests/run/titerslice.nim rename to tests/iter/titerslice.nim diff --git a/tests/run/titervaropenarray.nim b/tests/iter/titervaropenarray.nim similarity index 100% rename from tests/run/titervaropenarray.nim rename to tests/iter/titervaropenarray.nim diff --git a/tests/run/tmoditer.nim b/tests/iter/tmoditer.nim similarity index 100% rename from tests/run/tmoditer.nim rename to tests/iter/tmoditer.nim diff --git a/tests/reject/treciter.nim b/tests/iter/treciter.nim similarity index 100% rename from tests/reject/treciter.nim rename to tests/iter/treciter.nim diff --git a/tests/reject/twrongiter.nim b/tests/iter/twrongiter.nim similarity index 100% rename from tests/reject/twrongiter.nim rename to tests/iter/twrongiter.nim diff --git a/tests/reject/tlet.nim b/tests/let/tlet.nim similarity index 100% rename from tests/reject/tlet.nim rename to tests/let/tlet.nim diff --git a/tests/reject/tlet2.nim b/tests/let/tlet2.nim similarity index 100% rename from tests/reject/tlet2.nim rename to tests/let/tlet2.nim diff --git a/tests/run/thexlit.nim b/tests/lexer/thexlit.nim similarity index 100% rename from tests/run/thexlit.nim rename to tests/lexer/thexlit.nim diff --git a/tests/compile/thexrange.nim b/tests/lexer/thexrange.nim similarity index 100% rename from tests/compile/thexrange.nim rename to tests/lexer/thexrange.nim diff --git a/tests/compile/tident.nim b/tests/lexer/tident.nim similarity index 100% rename from tests/compile/tident.nim rename to tests/lexer/tident.nim diff --git a/tests/reject/tind1.nim b/tests/lexer/tind1.nim similarity index 100% rename from tests/reject/tind1.nim rename to tests/lexer/tind1.nim diff --git a/tests/run/tindent1.nim b/tests/lexer/tindent1.nim similarity index 100% rename from tests/run/tindent1.nim rename to tests/lexer/tindent1.nim diff --git a/tests/compile/tlexer.nim b/tests/lexer/tlexer.nim similarity index 100% rename from tests/compile/tlexer.nim rename to tests/lexer/tlexer.nim diff --git a/tests/reject/tmissingnl.nim b/tests/lexer/tmissingnl.nim similarity index 100% rename from tests/reject/tmissingnl.nim rename to tests/lexer/tmissingnl.nim diff --git a/tests/run/tstrlits.nim b/tests/lexer/tstrlits.nim similarity index 100% rename from tests/run/tstrlits.nim rename to tests/lexer/tstrlits.nim diff --git a/tests/reject/tunderscores.nim b/tests/lexer/tunderscores.nim similarity index 100% rename from tests/reject/tunderscores.nim rename to tests/lexer/tunderscores.nim diff --git a/tests/compile/tredef.nim b/tests/lookup/tredef.nim similarity index 100% rename from tests/compile/tredef.nim rename to tests/lookup/tredef.nim diff --git a/tests/run/tkoeniglookup.nim b/tests/lookups/tkoeniglookup.nim similarity index 100% rename from tests/run/tkoeniglookup.nim rename to tests/lookups/tkoeniglookup.nim diff --git a/tests/compile/tmacro1.nim b/tests/macro/tmacro1.nim similarity index 100% rename from tests/compile/tmacro1.nim rename to tests/macro/tmacro1.nim diff --git a/tests/run/tmacro2.nim b/tests/macro/tmacro2.nim similarity index 100% rename from tests/run/tmacro2.nim rename to tests/macro/tmacro2.nim diff --git a/tests/run/tmacro3.nim b/tests/macro/tmacro3.nim similarity index 100% rename from tests/run/tmacro3.nim rename to tests/macro/tmacro3.nim diff --git a/tests/run/tmacro4.nim b/tests/macro/tmacro4.nim similarity index 100% rename from tests/run/tmacro4.nim rename to tests/macro/tmacro4.nim diff --git a/tests/compile/tmacro2.nim b/tests/macro/tmacro5.nim similarity index 100% rename from tests/compile/tmacro2.nim rename to tests/macro/tmacro5.nim diff --git a/tests/compile/tmacroaspragma.nim b/tests/macro/tmacroaspragma.nim similarity index 100% rename from tests/compile/tmacroaspragma.nim rename to tests/macro/tmacroaspragma.nim diff --git a/tests/run/tmacrogenerics.nim b/tests/macro/tmacrogenerics.nim similarity index 100% rename from tests/run/tmacrogenerics.nim rename to tests/macro/tmacrogenerics.nim diff --git a/tests/run/tmacros1.nim b/tests/macro/tmacros1.nim similarity index 100% rename from tests/run/tmacros1.nim rename to tests/macro/tmacros1.nim diff --git a/tests/compile/tmacrostmt.nim b/tests/macro/tmacrostmt.nim similarity index 100% rename from tests/compile/tmacrostmt.nim rename to tests/macro/tmacrostmt.nim diff --git a/tests/compile/tmacrotypes.nim b/tests/macro/tmacrotypes.nim similarity index 100% rename from tests/compile/tmacrotypes.nim rename to tests/macro/tmacrotypes.nim diff --git a/tests/compile/tnimrodnode_for_runtime.nim b/tests/macro/tnimrodnode_for_runtime.nim similarity index 100% rename from tests/compile/tnimrodnode_for_runtime.nim rename to tests/macro/tnimrodnode_for_runtime.nim diff --git a/tests/run/tprintf.nim b/tests/macro/tprintf.nim similarity index 100% rename from tests/run/tprintf.nim rename to tests/macro/tprintf.nim diff --git a/tests/run/tquotewords.nim b/tests/macro/tquotewords.nim similarity index 100% rename from tests/run/tquotewords.nim rename to tests/macro/tquotewords.nim diff --git a/tests/reject/trecmacro.nim b/tests/macro/trecmacro.nim similarity index 100% rename from tests/reject/trecmacro.nim rename to tests/macro/trecmacro.nim diff --git a/tests/run/tstringinterp.nim b/tests/macro/tstringinterp.nim similarity index 100% rename from tests/run/tstringinterp.nim rename to tests/macro/tstringinterp.nim diff --git a/tests/run/tvtable.nim b/tests/macro/tvtable.nim similarity index 100% rename from tests/run/tvtable.nim rename to tests/macro/tvtable.nim diff --git a/tests/compile/tdumpast.nim b/tests/macros/tdumpast.nim similarity index 100% rename from tests/compile/tdumpast.nim rename to tests/macros/tdumpast.nim diff --git a/tests/compile/tdumpast2.nim b/tests/macros/tdumpast2.nim similarity index 100% rename from tests/compile/tdumpast2.nim rename to tests/macros/tdumpast2.nim diff --git a/tests/run/tdumptree.nim b/tests/macros/tdumptree.nim similarity index 100% rename from tests/run/tdumptree.nim rename to tests/macros/tdumptree.nim diff --git a/tests/run/tidgen.nim b/tests/macros/tidgen.nim similarity index 100% rename from tests/run/tidgen.nim rename to tests/macros/tidgen.nim diff --git a/tests/run/tlowhigh.nim b/tests/magics/tlowhigh.nim similarity index 100% rename from tests/run/tlowhigh.nim rename to tests/magics/tlowhigh.nim diff --git a/tests/run/tmatrix.nim b/tests/matrix/tmatrix.nim similarity index 100% rename from tests/run/tmatrix.nim rename to tests/matrix/tmatrix.nim diff --git a/tests/compile/tmatrix1.nim b/tests/matrix/tmatrix1.nim similarity index 100% rename from tests/compile/tmatrix1.nim rename to tests/matrix/tmatrix1.nim diff --git a/tests/compile/tmatrix2.nim b/tests/matrix/tmatrix2.nim similarity index 100% rename from tests/compile/tmatrix2.nim rename to tests/matrix/tmatrix2.nim diff --git a/tests/compile/tbindtypedesc.nim b/tests/metatype/tbindtypedesc.nim similarity index 100% rename from tests/compile/tbindtypedesc.nim rename to tests/metatype/tbindtypedesc.nim diff --git a/tests/compile/tcompositetypeclasses.nim b/tests/metatype/tcompositetypeclasses.nim similarity index 100% rename from tests/compile/tcompositetypeclasses.nim rename to tests/metatype/tcompositetypeclasses.nim diff --git a/tests/compile/tconstraints.nim b/tests/metatype/tconstraints.nim similarity index 100% rename from tests/compile/tconstraints.nim rename to tests/metatype/tconstraints.nim diff --git a/tests/run/tsemistatic.nim b/tests/metatype/tsemistatic.nim similarity index 100% rename from tests/run/tsemistatic.nim rename to tests/metatype/tsemistatic.nim 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 similarity index 100% rename from tests/compile/ttypeclasses.nim rename to tests/metatype/ttypeclasses.nim diff --git a/tests/run/ttypedesc1.nim b/tests/metatype/ttypedesc1.nim similarity index 100% rename from tests/run/ttypedesc1.nim rename to tests/metatype/ttypedesc1.nim diff --git a/tests/compile/ttypeselectors.nim b/tests/metatype/ttypeselectors.nim similarity index 100% rename from tests/compile/ttypeselectors.nim rename to tests/metatype/ttypeselectors.nim diff --git a/tests/run/ttypetraits.nim b/tests/metatype/ttypetraits.nim similarity index 100% rename from tests/run/ttypetraits.nim rename to tests/metatype/ttypetraits.nim diff --git a/tests/run/tusertypeclasses.nim b/tests/metatype/tusertypeclasses.nim similarity index 100% rename from tests/run/tusertypeclasses.nim rename to tests/metatype/tusertypeclasses.nim diff --git a/tests/run/utypeclasses.nim b/tests/metatype/utypeclasses.nim similarity index 100% rename from tests/run/utypeclasses.nim rename to tests/metatype/utypeclasses.nim diff --git a/tests/run/mmultim3.nim b/tests/method/mmultim3.nim similarity index 100% rename from tests/run/mmultim3.nim rename to tests/method/mmultim3.nim diff --git a/tests/reject/tmethod.nim b/tests/method/tmethod.nim similarity index 100% rename from tests/reject/tmethod.nim rename to tests/method/tmethod.nim diff --git a/tests/run/tmethods1.nim b/tests/method/tmethods1.nim similarity index 100% rename from tests/run/tmethods1.nim rename to tests/method/tmethods1.nim diff --git a/tests/run/tmultim1.nim b/tests/method/tmultim1.nim similarity index 100% rename from tests/run/tmultim1.nim rename to tests/method/tmultim1.nim diff --git a/tests/run/tmultim2.nim b/tests/method/tmultim2.nim similarity index 100% rename from tests/run/tmultim2.nim rename to tests/method/tmultim2.nim diff --git a/tests/run/tmultim3.nim b/tests/method/tmultim3.nim similarity index 100% rename from tests/run/tmultim3.nim rename to tests/method/tmultim3.nim diff --git a/tests/run/tmultim4.nim b/tests/method/tmultim4.nim similarity index 100% rename from tests/run/tmultim4.nim rename to tests/method/tmultim4.nim diff --git a/tests/run/tmultim6.nim b/tests/method/tmultim6.nim similarity index 100% rename from tests/run/tmultim6.nim rename to tests/method/tmultim6.nim diff --git a/tests/run/tsimmeth.nim b/tests/method/tsimmeth.nim similarity index 100% rename from tests/run/tsimmeth.nim rename to tests/method/tsimmeth.nim diff --git a/tests/reject/mopaque.nim b/tests/module/mopaque.nim similarity index 100% rename from tests/reject/mopaque.nim rename to tests/module/mopaque.nim diff --git a/tests/compile/mrecmod.nim b/tests/module/mrecmod.nim similarity index 100% rename from tests/compile/mrecmod.nim rename to tests/module/mrecmod.nim diff --git a/tests/compile/mrecmod2.nim b/tests/module/mrecmod2.nim similarity index 100% rename from tests/compile/mrecmod2.nim rename to tests/module/mrecmod2.nim diff --git a/tests/reject/topaque.nim b/tests/module/topaque.nim similarity index 100% rename from tests/reject/topaque.nim rename to tests/module/topaque.nim diff --git a/tests/reject/trecinca.nim b/tests/module/trecinca.nim similarity index 100% rename from tests/reject/trecinca.nim rename to tests/module/trecinca.nim diff --git a/tests/reject/trecincb.nim b/tests/module/trecincb.nim similarity index 100% rename from tests/reject/trecincb.nim rename to tests/module/trecincb.nim diff --git a/tests/compile/trecmod.nim b/tests/module/trecmod.nim similarity index 100% rename from tests/compile/trecmod.nim rename to tests/module/trecmod.nim diff --git a/tests/compile/trecmod2.nim b/tests/module/trecmod2.nim similarity index 100% rename from tests/compile/trecmod2.nim rename to tests/module/trecmod2.nim diff --git a/tests/compile/mexporta.nim b/tests/modules/mexporta.nim similarity index 100% rename from tests/compile/mexporta.nim rename to tests/modules/mexporta.nim diff --git a/tests/compile/mexportb.nim b/tests/modules/mexportb.nim similarity index 100% rename from tests/compile/mexportb.nim rename to tests/modules/mexportb.nim diff --git a/tests/compile/texport.nim b/tests/modules/texport.nim similarity index 100% rename from tests/compile/texport.nim rename to tests/modules/texport.nim diff --git a/tests/reject/timportexcept.nim b/tests/modules/timportexcept.nim similarity index 100% rename from tests/reject/timportexcept.nim rename to tests/modules/timportexcept.nim diff --git a/tests/reject/tnamedparams.nim b/tests/namedparams/tnamedparams.nim similarity index 100% rename from tests/reject/tnamedparams.nim rename to tests/namedparams/tnamedparams.nim diff --git a/tests/compile/tnamedparams.nim b/tests/namedparams/tnamedparams2.nim similarity index 100% rename from tests/compile/tnamedparams.nim rename to tests/namedparams/tnamedparams2.nim diff --git a/tests/reject/mnamspc1.nim b/tests/namspc/mnamspc1.nim similarity index 100% rename from tests/reject/mnamspc1.nim rename to tests/namspc/mnamspc1.nim diff --git a/tests/reject/mnamspc2.nim b/tests/namspc/mnamspc2.nim similarity index 100% rename from tests/reject/mnamspc2.nim rename to tests/namspc/mnamspc2.nim diff --git a/tests/reject/tnamspc.nim b/tests/namspc/tnamspc.nim similarity index 100% rename from tests/reject/tnamspc.nim rename to tests/namspc/tnamspc.nim diff --git a/tests/reject/tnotnil.nim b/tests/notnil/tnotnil.nim similarity index 100% rename from tests/reject/tnotnil.nim rename to tests/notnil/tnotnil.nim diff --git a/tests/reject/tnotnil1.nim b/tests/notnil/tnotnil1.nim similarity index 100% rename from tests/reject/tnotnil1.nim rename to tests/notnil/tnotnil1.nim diff --git a/tests/reject/tnotnil2.nim b/tests/notnil/tnotnil2.nim similarity index 100% rename from tests/reject/tnotnil2.nim rename to tests/notnil/tnotnil2.nim diff --git a/tests/run/tobjconstr.nim b/tests/object/tobjconstr.nim similarity index 100% rename from tests/run/tobjconstr.nim rename to tests/object/tobjconstr.nim diff --git a/tests/compile/tobjconstr2.nim b/tests/object/tobjconstr2.nim similarity index 100% rename from tests/compile/tobjconstr2.nim rename to tests/object/tobjconstr2.nim diff --git a/tests/compile/tobjcov.nim b/tests/object/tobjcov.nim similarity index 100% rename from tests/compile/tobjcov.nim rename to tests/object/tobjcov.nim diff --git a/tests/run/tobject.nim b/tests/object/tobject.nim similarity index 100% rename from tests/run/tobject.nim rename to tests/object/tobject.nim diff --git a/tests/compile/tobject2.nim b/tests/object/tobject2.nim similarity index 100% rename from tests/compile/tobject2.nim rename to tests/object/tobject2.nim diff --git a/tests/compile/tobject3.nim b/tests/object/tobject3.nim similarity index 100% rename from tests/compile/tobject3.nim rename to tests/object/tobject3.nim diff --git a/tests/compile/toop.nim b/tests/object/toop.nim similarity index 100% rename from tests/compile/toop.nim rename to tests/object/toop.nim diff --git a/tests/run/toop1.nim b/tests/object/toop1.nim similarity index 100% rename from tests/run/toop1.nim rename to tests/object/toop1.nim diff --git a/tests/compile/tobjects.nim b/tests/objects/tobjects.nim similarity index 100% rename from tests/compile/tobjects.nim rename to tests/objects/tobjects.nim diff --git a/tests/reject/tadrdisc.nim b/tests/objvariant/tadrdisc.nim similarity index 100% rename from tests/reject/tadrdisc.nim rename to tests/objvariant/tadrdisc.nim diff --git a/tests/reject/tcheckedfield1.nim b/tests/objvariant/tcheckedfield1.nim similarity index 100% rename from tests/reject/tcheckedfield1.nim rename to tests/objvariant/tcheckedfield1.nim diff --git a/tests/reject/temptycaseobj.nim b/tests/objvariant/temptycaseobj.nim similarity index 100% rename from tests/reject/temptycaseobj.nim rename to tests/objvariant/temptycaseobj.nim diff --git a/tests/run/tvariantstack.nim b/tests/objvariant/tvariantstack.nim similarity index 100% rename from tests/run/tvariantstack.nim rename to tests/objvariant/tvariantstack.nim diff --git a/tests/reject/topena1.nim b/tests/openarray/topena1.nim similarity index 100% rename from tests/reject/topena1.nim rename to tests/openarray/topena1.nim diff --git a/tests/run/topenarrayrepr.nim b/tests/openarray/topenarrayrepr.nim similarity index 100% rename from tests/run/topenarrayrepr.nim rename to tests/openarray/topenarrayrepr.nim diff --git a/tests/run/topenlen.nim b/tests/openarray/topenlen.nim similarity index 100% rename from tests/run/topenlen.nim rename to tests/openarray/topenlen.nim diff --git a/tests/run/tofopr.nim b/tests/operator/tofopr.nim similarity index 100% rename from tests/run/tofopr.nim rename to tests/operator/tofopr.nim diff --git a/tests/run/toprprec.nim b/tests/operator/toprprec.nim similarity index 100% rename from tests/run/toprprec.nim rename to tests/operator/toprprec.nim diff --git a/tests/run/tprecedence.nim b/tests/operator/tprecedence.nim similarity index 100% rename from tests/run/tprecedence.nim rename to tests/operator/tprecedence.nim diff --git a/tests/run/toverflw.nim b/tests/overflw/toverflw.nim similarity index 100% rename from tests/run/toverflw.nim rename to tests/overflw/toverflw.nim diff --git a/tests/run/toverflw2.nim b/tests/overflw/toverflw2.nim similarity index 100% rename from tests/run/toverflw2.nim rename to tests/overflw/toverflw2.nim diff --git a/tests/run/tovfint.nim b/tests/overflw/tovfint.nim similarity index 100% rename from tests/run/tovfint.nim rename to tests/overflw/tovfint.nim diff --git a/tests/reject/toverl.nim b/tests/overload/toverl.nim similarity index 100% rename from tests/reject/toverl.nim rename to tests/overload/toverl.nim diff --git a/tests/run/toverl2.nim b/tests/overload/toverl2.nim similarity index 100% rename from tests/run/toverl2.nim rename to tests/overload/toverl2.nim diff --git a/tests/run/toverl3.nim b/tests/overload/toverl3.nim similarity index 100% rename from tests/run/toverl3.nim rename to tests/overload/toverl3.nim diff --git a/tests/compile/toverprc.nim b/tests/overload/toverprc.nim similarity index 100% rename from tests/compile/toverprc.nim rename to tests/overload/toverprc.nim diff --git a/tests/run/toverwr.nim b/tests/overload/toverwr.nim similarity index 100% rename from tests/run/toverwr.nim rename to tests/overload/toverwr.nim diff --git a/tests/run/tpatterns.nim b/tests/pattern/tpatterns.nim similarity index 100% rename from tests/run/tpatterns.nim rename to tests/pattern/tpatterns.nim diff --git a/tests/compile/tuserpragma.nim b/tests/pragma/tuserpragma.nim similarity index 100% rename from tests/compile/tuserpragma.nim rename to tests/pragma/tuserpragma.nim diff --git a/tests/compile/tpush.nim b/tests/pragmas/tpush.nim similarity index 100% rename from tests/compile/tpush.nim rename to tests/pragmas/tpush.nim diff --git a/tests/run/tnestprc.nim b/tests/proc/tnestprc.nim similarity index 100% rename from tests/run/tnestprc.nim rename to tests/proc/tnestprc.nim diff --git a/tests/reject/tprocredef.nim b/tests/proc/tprocredef.nim similarity index 100% rename from tests/reject/tprocredef.nim rename to tests/proc/tprocredef.nim diff --git a/tests/compile/tgenericprocvar.nim b/tests/procvar/tgenericprocvar.nim similarity index 100% rename from tests/compile/tgenericprocvar.nim rename to tests/procvar/tgenericprocvar.nim diff --git a/tests/reject/tprocvar.nim b/tests/procvar/tprocvar.nim similarity index 100% rename from tests/reject/tprocvar.nim rename to tests/procvar/tprocvar.nim diff --git a/tests/run/tprocvar.nim b/tests/procvar/tprocvar2.nim similarity index 100% rename from tests/run/tprocvar.nim rename to tests/procvar/tprocvar2.nim diff --git a/tests/compile/tprocvars.nim b/tests/procvar/tprocvars.nim similarity index 100% rename from tests/compile/tprocvars.nim rename to tests/procvar/tprocvars.nim diff --git a/tests/compile/compilehelpers.nim b/tests/range/compilehelpers.nim similarity index 100% rename from tests/compile/compilehelpers.nim rename to tests/range/compilehelpers.nim diff --git a/tests/run/tbug499771.nim b/tests/range/tbug499771.nim similarity index 100% rename from tests/run/tbug499771.nim rename to tests/range/tbug499771.nim diff --git a/tests/compile/tcolors.nim b/tests/range/tcolors.nim similarity index 100% rename from tests/compile/tcolors.nim rename to tests/range/tcolors.nim diff --git a/tests/compile/tmatrix3.nim b/tests/range/tmatrix3.nim similarity index 100% rename from tests/compile/tmatrix3.nim rename to tests/range/tmatrix3.nim diff --git a/tests/reject/tsubrange.nim b/tests/range/tsubrange.nim similarity index 100% rename from tests/reject/tsubrange.nim rename to tests/range/tsubrange.nim diff --git a/tests/run/tsubrange2.nim b/tests/range/tsubrange2.nim similarity index 100% rename from tests/run/tsubrange2.nim rename to tests/range/tsubrange2.nim diff --git a/tests/run/tsubrange.nim b/tests/range/tsubrange3.nim similarity index 100% rename from tests/run/tsubrange.nim rename to 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/t99bott.nim b/tests/reject/t99bott.nim deleted file mode 100644 index d18cb0d5c..000000000 --- a/tests/reject/t99bott.nim +++ /dev/null @@ -1,36 +0,0 @@ -discard """ - file: "t99bott.nim" - line: 26 - errormsg: "cannot evaluate at compile time: bn" - disabled: false -""" -## 99 Bottles of Beer -## http://www.99-bottles-of-beer.net/ -## Nimrod version - -## Author: Philippe Lhoste 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/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/tinvwhen.nim b/tests/reject/tinvwhen.nim deleted file mode 100644 index ea8a7ddf0..000000000 --- a/tests/reject/tinvwhen.nim +++ /dev/null @@ -1,15 +0,0 @@ -discard """ - file: "tinvwhen.nim" - line: 11 - errormsg: "invalid indentation" -""" -# This was parsed even though it should not! - -proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".} - -proc getcwd(buf: CString, buflen: cint): CString - when defined(unix): {.importc: "getcwd", header: "".} #ERROR_MSG invalid indentation - elif defined(windows): {.importc: "getcwd", header: ""} - else: {.error: "os library not ported to your OS. Please help!".} - - 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 cd0f538e6..000000000 --- a/tests/reject/tnot.nim +++ /dev/null @@ -1,22 +0,0 @@ -discard """ - file: "tnot.nim" - line: 14 - 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/tdomulttest.nim b/tests/run/tdomulttest.nim deleted file mode 100644 index 4ee6de128..000000000 --- a/tests/run/tdomulttest.nim +++ /dev/null @@ -1,17 +0,0 @@ -discard """ - file: "tdomulttest.nim" - output: "555\ntest\nmulti lines\n99999999\nend" - disabled: true -""" -proc foo(bar, baz: proc (x: int): int) = - echo bar(555) - echo baz(99999999) - -foo do (x: int) -> int: - return x -do (x: int) -> int: - echo("test") - echo("multi lines") - return x - -echo("end") \ No newline at end of file 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 180acd89b..000000000 --- a/tests/run/tmemoization.nim +++ /dev/null @@ -1,17 +0,0 @@ -discard """ - msg: "test 1\ntest 2\ntest 3" - output: "TEST 1\nTEST 2\nTEST 3" -""" - -import strutils - -proc foo(s: static[string]): string = - static: echo s - - const R = s.toUpper - return R - -echo foo("test 1") -echo foo("test 2") -echo foo("test " & $3) - 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/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 similarity index 100% rename from tests/compile/tseq2.nim rename to tests/seq/tseq2.nim diff --git a/tests/run/tseqcon.nim b/tests/seq/tseqcon.nim similarity index 100% rename from tests/run/tseqcon.nim rename to tests/seq/tseqcon.nim diff --git a/tests/compile/tseqcon2.nim b/tests/seq/tseqcon2.nim similarity index 100% rename from tests/compile/tseqcon2.nim rename to tests/seq/tseqcon2.nim diff --git a/tests/run/tseqtuple.nim b/tests/seq/tseqtuple.nim similarity index 100% rename from tests/run/tseqtuple.nim rename to tests/seq/tseqtuple.nim diff --git a/tests/run/tsequtils.nim b/tests/seq/tsequtils.nim similarity index 100% rename from tests/run/tsequtils.nim rename to tests/seq/tsequtils.nim diff --git a/tests/run/ttoseq.nim b/tests/seq/ttoseq.nim similarity index 100% rename from tests/run/ttoseq.nim rename to tests/seq/ttoseq.nim diff --git a/tests/run/tsets.nim b/tests/sets/tsets.nim similarity index 100% rename from tests/run/tsets.nim rename to tests/sets/tsets.nim diff --git a/tests/run/tsets2.nim b/tests/sets/tsets2.nim similarity index 100% rename from tests/run/tsets2.nim rename to tests/sets/tsets2.nim diff --git a/tests/run/tstaticparams.nim b/tests/static/tstaticparams.nim similarity index 100% rename from tests/run/tstaticparams.nim rename to tests/static/tstaticparams.nim diff --git a/tests/compile/tcputime.nim b/tests/stdlib/tcputime.nim similarity index 100% rename from tests/compile/tcputime.nim rename to tests/stdlib/tcputime.nim diff --git a/tests/run/tcritbits.nim b/tests/stdlib/tcritbits.nim similarity index 100% rename from tests/run/tcritbits.nim rename to tests/stdlib/tcritbits.nim diff --git a/tests/compile/tdialogs.nim b/tests/stdlib/tdialogs.nim similarity index 100% rename from tests/compile/tdialogs.nim rename to tests/stdlib/tdialogs.nim diff --git a/tests/compile/techo.nim b/tests/stdlib/techo.nim similarity index 100% rename from tests/compile/techo.nim rename to tests/stdlib/techo.nim diff --git a/tests/run/tformat.nim b/tests/stdlib/tformat.nim similarity index 100% rename from tests/run/tformat.nim rename to tests/stdlib/tformat.nim diff --git a/tests/run/thashes.nim b/tests/stdlib/thashes.nim similarity index 100% rename from tests/run/thashes.nim rename to tests/stdlib/thashes.nim diff --git a/tests/compile/tio.nim b/tests/stdlib/tio.nim similarity index 100% rename from tests/compile/tio.nim rename to tests/stdlib/tio.nim diff --git a/tests/compile/tircbot.nim b/tests/stdlib/tircbot.nim similarity index 100% rename from tests/compile/tircbot.nim rename to tests/stdlib/tircbot.nim diff --git a/tests/run/tlists.nim b/tests/stdlib/tlists.nim similarity index 100% rename from tests/run/tlists.nim rename to tests/stdlib/tlists.nim diff --git a/tests/compile/tmarshal.nim b/tests/stdlib/tmarshal.nim similarity index 100% rename from tests/compile/tmarshal.nim rename to tests/stdlib/tmarshal.nim diff --git a/tests/run/tmath.nim b/tests/stdlib/tmath.nim similarity index 100% rename from tests/run/tmath.nim rename to tests/stdlib/tmath.nim diff --git a/tests/compile/tmath.nim b/tests/stdlib/tmath2.nim similarity index 100% rename from tests/compile/tmath.nim rename to tests/stdlib/tmath2.nim diff --git a/tests/compile/tmongo.nim b/tests/stdlib/tmongo.nim similarity index 100% rename from tests/compile/tmongo.nim rename to tests/stdlib/tmongo.nim diff --git a/tests/compile/tos.nim b/tests/stdlib/tos.nim similarity index 100% rename from tests/compile/tos.nim rename to tests/stdlib/tos.nim diff --git a/tests/compile/tparscfg.nim b/tests/stdlib/tparscfg.nim similarity index 100% rename from tests/compile/tparscfg.nim rename to tests/stdlib/tparscfg.nim diff --git a/tests/compile/tparsefloat.nim b/tests/stdlib/tparsefloat.nim similarity index 100% rename from tests/compile/tparsefloat.nim rename to tests/stdlib/tparsefloat.nim diff --git a/tests/compile/tparsopt.nim b/tests/stdlib/tparsopt.nim similarity index 100% rename from tests/compile/tparsopt.nim rename to tests/stdlib/tparsopt.nim diff --git a/tests/run/tpegs.nim b/tests/stdlib/tpegs.nim similarity index 100% rename from tests/run/tpegs.nim rename to tests/stdlib/tpegs.nim diff --git a/tests/compile/tposix.nim b/tests/stdlib/tposix.nim similarity index 100% rename from tests/compile/tposix.nim rename to tests/stdlib/tposix.nim diff --git a/tests/compile/tquit.nim b/tests/stdlib/tquit.nim similarity index 100% rename from tests/compile/tquit.nim rename to tests/stdlib/tquit.nim diff --git a/tests/run/tregex.nim b/tests/stdlib/tregex.nim similarity index 100% rename from tests/run/tregex.nim rename to tests/stdlib/tregex.nim diff --git a/tests/run/treguse.nim b/tests/stdlib/treguse.nim similarity index 100% rename from tests/run/treguse.nim rename to tests/stdlib/treguse.nim diff --git a/tests/run/trepr.nim b/tests/stdlib/trepr.nim similarity index 100% rename from tests/run/trepr.nim rename to tests/stdlib/trepr.nim diff --git a/tests/compile/trepr.nim b/tests/stdlib/trepr2.nim similarity index 100% rename from tests/compile/trepr.nim rename to tests/stdlib/trepr2.nim diff --git a/tests/compile/tsockets.nim b/tests/stdlib/tsockets.nim similarity index 100% rename from tests/compile/tsockets.nim rename to tests/stdlib/tsockets.nim diff --git a/tests/compile/tsortcall.nim b/tests/stdlib/tsortcall.nim similarity index 100% rename from tests/compile/tsortcall.nim rename to tests/stdlib/tsortcall.nim diff --git a/tests/run/tsplit.nim b/tests/stdlib/tsplit.nim similarity index 100% rename from tests/run/tsplit.nim rename to tests/stdlib/tsplit.nim diff --git a/tests/compile/tstreams.nim b/tests/stdlib/tstreams.nim similarity index 100% rename from tests/compile/tstreams.nim rename to tests/stdlib/tstreams.nim diff --git a/tests/compile/tstrset.nim b/tests/stdlib/tstrset.nim similarity index 100% rename from tests/compile/tstrset.nim rename to tests/stdlib/tstrset.nim diff --git a/tests/compile/tstrtabs.nim b/tests/stdlib/tstrtabs.nim similarity index 100% rename from tests/compile/tstrtabs.nim rename to tests/stdlib/tstrtabs.nim diff --git a/tests/run/tstrutil.nim b/tests/stdlib/tstrutil.nim similarity index 100% rename from tests/run/tstrutil.nim rename to tests/stdlib/tstrutil.nim diff --git a/tests/compile/ttime.nim b/tests/stdlib/ttime.nim similarity index 100% rename from tests/compile/ttime.nim rename to tests/stdlib/ttime.nim diff --git a/tests/run/tunidecode.nim b/tests/stdlib/tunidecode.nim similarity index 100% rename from tests/run/tunidecode.nim rename to tests/stdlib/tunidecode.nim diff --git a/tests/compile/twalker.nim b/tests/stdlib/twalker.nim similarity index 100% rename from tests/compile/twalker.nim rename to tests/stdlib/twalker.nim diff --git a/tests/run/txmlgen.nim b/tests/stdlib/txmlgen.nim similarity index 100% rename from tests/run/txmlgen.nim rename to tests/stdlib/txmlgen.nim diff --git a/tests/run/txmltree.nim b/tests/stdlib/txmltree.nim similarity index 100% rename from tests/run/txmltree.nim rename to tests/stdlib/txmltree.nim diff --git a/tests/compile/ttableconstr.nim b/tests/table/ttableconstr.nim similarity index 100% rename from tests/compile/ttableconstr.nim rename to tests/table/ttableconstr.nim diff --git a/tests/run/ttables.nim b/tests/table/ttables.nim similarity index 100% rename from tests/run/ttables.nim rename to tests/table/ttables.nim diff --git a/tests/run/ttables2.nim b/tests/table/ttables2.nim similarity index 100% rename from tests/run/ttables2.nim rename to tests/table/ttables2.nim diff --git a/tests/templates/mcan_access_hidden_field.nim b/tests/template/mcan_access_hidden_field.nim similarity index 100% rename from tests/templates/mcan_access_hidden_field.nim rename to tests/template/mcan_access_hidden_field.nim diff --git a/tests/compile/mtempl5.nim b/tests/template/mtempl5.nim similarity index 100% rename from tests/compile/mtempl5.nim rename to tests/template/mtempl5.nim diff --git a/tests/templates/tcan_access_hidden_field.nim b/tests/template/tcan_access_hidden_field.nim similarity index 100% rename from tests/templates/tcan_access_hidden_field.nim rename to tests/template/tcan_access_hidden_field.nim diff --git a/tests/compile/thygienictempl.nim b/tests/template/thygienictempl.nim similarity index 100% rename from tests/compile/thygienictempl.nim rename to tests/template/thygienictempl.nim diff --git a/tests/compile/tmodulealias.nim b/tests/template/tmodulealias.nim similarity index 100% rename from tests/compile/tmodulealias.nim rename to tests/template/tmodulealias.nim diff --git a/tests/run/tstempl.nim b/tests/template/tstempl.nim similarity index 100% rename from tests/run/tstempl.nim rename to tests/template/tstempl.nim diff --git a/tests/compile/ttempl.nim b/tests/template/ttempl.nim similarity index 100% rename from tests/compile/ttempl.nim rename to tests/template/ttempl.nim diff --git a/tests/reject/ttempl2.nim b/tests/template/ttempl2.nim similarity index 100% rename from tests/reject/ttempl2.nim rename to tests/template/ttempl2.nim diff --git a/tests/compile/ttempl3.nim b/tests/template/ttempl3.nim similarity index 100% rename from tests/compile/ttempl3.nim rename to tests/template/ttempl3.nim diff --git a/tests/compile/ttempl4.nim b/tests/template/ttempl4.nim similarity index 100% rename from tests/compile/ttempl4.nim rename to tests/template/ttempl4.nim diff --git a/tests/compile/ttempl5.nim b/tests/template/ttempl5.nim similarity index 100% rename from tests/compile/ttempl5.nim rename to tests/template/ttempl5.nim diff --git a/tests/compile/ttemplreturntype.nim b/tests/template/ttemplreturntype.nim similarity index 100% rename from tests/compile/ttemplreturntype.nim rename to tests/template/ttemplreturntype.nim diff --git a/tests/run/utemplates.nim b/tests/template/utemplates.nim similarity index 100% rename from tests/run/utemplates.nim rename to tests/template/utemplates.nim diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim new file mode 100644 index 000000000..65d040b24 --- /dev/null +++ b/tests/testament/backend.nim @@ -0,0 +1,120 @@ +# +# +# The Nimrod Tester +# (c) Copyright 2013 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 = + let hash = "git log -n 1"() + 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/testament/categories.nim b/tests/testament/categories.nim new file mode 100644 index 000000000..68a61a973 --- /dev/null +++ b/tests/testament/categories.nim @@ -0,0 +1,256 @@ +# +# +# 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 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(cat.string / "t*.nim"): + testSpec r, makeTest(name, options, cat) 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..2c9a32e5e --- /dev/null +++ b/tests/testament/tester.nim @@ -0,0 +1,267 @@ +# +# +# 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, browsers, json, + marshal, cgi, backend, parseopt, specs #, caas + +const + resultsFile = "testresults.html" + jsonFile = "testresults.json" + Usage = """Usage: + tester [options] command [arguments] + +Command: + all run all tests + c|category run all the tests of a certain category + html generate $1 from the database +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
\n" & + "Tests skipped: $2 / $3
\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 != "testament": + processCategory(r, Category(dir), p.cmdLineRest.string) + for a in AdditionalCategories: + processCategory(r, Category(a), p.cmdLineRest.string) + of "c", "category": + var cat = Category(p.key) + p.next + processCategory(r, cat, p.cmdLineRest.string) + of "html": + quit "too implement" + else: + quit usage + + if optPrintResults: echo r, r.data + backend.close() + +if paramCount() == 0: + quit usage +main() + diff --git a/tests/reject/tdisallowif.nim b/tests/trmacros/tdisallowif.nim similarity index 100% rename from tests/reject/tdisallowif.nim rename to tests/trmacros/tdisallowif.nim diff --git a/tests/run/tanontuples.nim b/tests/tuples/tanontuples.nim similarity index 100% rename from tests/run/tanontuples.nim rename to tests/tuples/tanontuples.nim diff --git a/tests/reject/twrongtupleaccess.nim b/tests/tuples/twrongtupleaccess.nim similarity index 100% rename from tests/reject/twrongtupleaccess.nim rename to tests/tuples/twrongtupleaccess.nim diff --git a/tests/compile/tcommontype.nim b/tests/typerel/tcommontype.nim similarity index 100% rename from tests/compile/tcommontype.nim rename to tests/typerel/tcommontype.nim diff --git a/tests/reject/tno_int_in_bool_context.nim b/tests/typerel/tno_int_in_bool_context.nim similarity index 100% rename from tests/reject/tno_int_in_bool_context.nim rename to tests/typerel/tno_int_in_bool_context.nim diff --git a/tests/compile/tnoargopenarray.nim b/tests/typerel/tnoargopenarray.nim similarity index 100% rename from tests/compile/tnoargopenarray.nim rename to tests/typerel/tnoargopenarray.nim diff --git a/tests/reject/tnocontains.nim b/tests/typerel/tnocontains.nim similarity index 100% rename from tests/reject/tnocontains.nim rename to tests/typerel/tnocontains.nim diff --git a/tests/compile/trectuple.nim b/tests/typerel/trectuple.nim similarity index 100% rename from tests/compile/trectuple.nim rename to tests/typerel/trectuple.nim diff --git a/tests/compile/trectuples.nim b/tests/typerel/trectuples.nim similarity index 100% rename from tests/compile/trectuples.nim rename to tests/typerel/trectuples.nim diff --git a/tests/reject/trectype.nim b/tests/typerel/trectype.nim similarity index 100% rename from tests/reject/trectype.nim rename to tests/typerel/trectype.nim diff --git a/tests/reject/trefs.nim b/tests/typerel/trefs.nim similarity index 100% rename from tests/reject/trefs.nim rename to tests/typerel/trefs.nim diff --git a/tests/run/trettypeinference.nim b/tests/typerel/trettypeinference.nim similarity index 100% rename from tests/run/trettypeinference.nim rename to tests/typerel/trettypeinference.nim diff --git a/tests/compile/tsecondarrayproperty.nim b/tests/typerel/tsecondarrayproperty.nim similarity index 100% rename from tests/compile/tsecondarrayproperty.nim rename to tests/typerel/tsecondarrayproperty.nim diff --git a/tests/compile/ttuple1.nim b/tests/typerel/ttuple1.nim similarity index 100% rename from tests/compile/ttuple1.nim rename to tests/typerel/ttuple1.nim diff --git a/tests/reject/ttypelessemptyset.nim b/tests/typerel/ttypelessemptyset.nim similarity index 100% rename from tests/reject/ttypelessemptyset.nim rename to tests/typerel/ttypelessemptyset.nim diff --git a/tests/reject/ttypenoval.nim b/tests/typerel/ttypenoval.nim similarity index 100% rename from tests/reject/ttypenoval.nim rename to tests/typerel/ttypenoval.nim diff --git a/tests/reject/ttypenovalue.nim b/tests/typerel/ttypenovalue.nim similarity index 100% rename from tests/reject/ttypenovalue.nim rename to tests/typerel/ttypenovalue.nim diff --git a/tests/compile/tvoid.nim b/tests/typerel/tvoid.nim similarity index 100% rename from tests/compile/tvoid.nim rename to tests/typerel/tvoid.nim diff --git a/tests/compile/typalias.nim b/tests/typerel/typalias.nim similarity index 100% rename from tests/compile/typalias.nim rename to tests/typerel/typalias.nim diff --git a/tests/reject/typredef.nim b/tests/typerel/typredef.nim similarity index 100% rename from tests/reject/typredef.nim rename to tests/typerel/typredef.nim diff --git a/tests/run/tfinalobj.nim b/tests/types/tfinalobj.nim similarity index 100% rename from tests/run/tfinalobj.nim rename to tests/types/tfinalobj.nim diff --git a/tests/compile/tforwty.nim b/tests/types/tforwty.nim similarity index 100% rename from tests/compile/tforwty.nim rename to tests/types/tforwty.nim diff --git a/tests/compile/tforwty2.nim b/tests/types/tforwty2.nim similarity index 100% rename from tests/compile/tforwty2.nim rename to tests/types/tforwty2.nim diff --git a/tests/reject/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim similarity index 100% rename from tests/reject/tillegaltyperecursion.nim rename to tests/types/tillegaltyperecursion.nim diff --git a/tests/reject/tillrec.nim b/tests/types/tillrec.nim similarity index 100% rename from tests/reject/tillrec.nim rename to tests/types/tillrec.nim diff --git a/tests/compile/tinheritref.nim b/tests/types/tinheritref.nim similarity index 100% rename from tests/compile/tinheritref.nim rename to tests/types/tinheritref.nim diff --git a/tests/compile/tisop.nim b/tests/types/tisop.nim similarity index 100% rename from tests/compile/tisop.nim rename to tests/types/tisop.nim diff --git a/tests/run/tisopr.nim b/tests/types/tisopr.nim similarity index 100% rename from tests/run/tisopr.nim rename to tests/types/tisopr.nim diff --git a/tests/run/tusingstatement.nim b/tests/usingstmt/tusingstatement.nim similarity index 100% rename from tests/run/tusingstatement.nim rename to tests/usingstmt/tusingstatement.nim diff --git a/tests/reject/tvarres1.nim b/tests/varres/tvarres1.nim similarity index 100% rename from tests/reject/tvarres1.nim rename to tests/varres/tvarres1.nim diff --git a/tests/reject/tvarres2.nim b/tests/varres/tvarres2.nim similarity index 100% rename from tests/reject/tvarres2.nim rename to tests/varres/tvarres2.nim diff --git a/tests/run/tvarres1.nim b/tests/varres/tvarres3.nim similarity index 100% rename from tests/run/tvarres1.nim rename to tests/varres/tvarres3.nim diff --git a/tests/run/tvarres2.nim b/tests/varres/tvarres4.nim similarity index 100% rename from tests/run/tvarres2.nim rename to tests/varres/tvarres4.nim diff --git a/tests/run/tvartup.nim b/tests/varres/tvartup.nim similarity index 100% rename from tests/run/tvartup.nim rename to tests/varres/tvartup.nim diff --git a/tests/run/tlet.nim b/tests/varstmt/tlet.nim similarity index 100% rename from tests/run/tlet.nim rename to tests/varstmt/tlet.nim diff --git a/tests/run/tvardecl.nim b/tests/varstmt/tvardecl.nim similarity index 100% rename from tests/run/tvardecl.nim rename to tests/varstmt/tvardecl.nim diff --git a/tests/compile/tconsteval.nim b/tests/vm/tconsteval.nim similarity index 100% rename from tests/compile/tconsteval.nim rename to tests/vm/tconsteval.nim diff --git a/tests/compile/teval1.nim b/tests/vm/teval1.nim similarity index 100% rename from tests/compile/teval1.nim rename to tests/vm/teval1.nim diff --git a/tests/compile/tslurp.nim b/tests/vm/tslurp.nim similarity index 100% rename from tests/compile/tslurp.nim rename to tests/vm/tslurp.nim diff --git a/tests/reject/twrongconst.nim b/tests/vm/twrongconst.nim similarity index 100% rename from tests/reject/twrongconst.nim rename to tests/vm/twrongconst.nim