From: fennecdjay Date: Sun, 3 Nov 2019 22:30:08 +0000 (+0100) Subject: :art: more coverage X-Git-Tag: nightly~2116^2~12 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3dc0c1412d5250f9b330620521bb78f491674860;p=gwion.git :art: more coverage --- diff --git a/src/import/typedef.c b/src/import/typedef.c index a89617b0..100ee825 100644 --- a/src/import/typedef.c +++ b/src/import/typedef.c @@ -34,8 +34,10 @@ ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag) { Type_Decl *td = gwi->ck->td; td->flag |= flag; const Type_Def tdef = new_type_def(gwi->gwion->mp, td, gwi->ck->sym); + gwi->ck->td = NULL; if(td->types) tdef->tmpl = new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1); + tdef->tmpl = NULL; const m_bool ret = traverse_type_def(gwi->gwion->env, tdef); const Type t = tdef->type; free_type_def(gwi->gwion->mp, tdef); diff --git a/tests/import/typedef_fail.c b/tests/import/typedef_fail.c new file mode 100644 index 00000000..a81d793d --- /dev/null +++ b/tests/import/typedef_fail.c @@ -0,0 +1,18 @@ +#include "gwion_util.h" +#include "gwion_ast.h" +#include "oo.h" +#include "vm.h" +#include "env.h" +#include "type.h" +#include "object.h" +#include "instr.h" +#include "gwion.h" +#include "value.h" +#include "operator.h" +#include "import.h" + +GWION_IMPORT(typedef_test) { + GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef<~A~>")) + GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef<~A~>")) + return GW_OK; +} diff --git a/tests/import/typedef_tmpl.c b/tests/import/typedef_tmpl.c index 2a48bedd..b3ec7251 100644 --- a/tests/import/typedef_tmpl.c +++ b/tests/import/typedef_tmpl.c @@ -12,7 +12,7 @@ #include "import.h" GWION_IMPORT(typedef_test) { - GWI_OB(gwi_typedef_ini(gwi, "int", "<~A~>Typedef")) - GWI_OB(gwi_typedef_end(gwi, ae_flag_none)) + GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef<~A~>")) + GWI_BB(gwi_typedef_end(gwi, ae_flag_none)) return GW_OK; } diff --git a/tests/sh/import.sh b/tests/sh/import.sh index 0d4e0450..ca0a55f6 100644 --- a/tests/sh/import.sh +++ b/tests/sh/import.sh @@ -1,5 +1,5 @@ #!/bin/bash -# [test] #61 +# [test] #62 n=0 [ "$1" ] && n="$1"