]> Nishi Git Mirror - gwion.git/commitdiff
:art: more coverage
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 3 Nov 2019 22:30:08 +0000 (23:30 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 3 Nov 2019 22:30:08 +0000 (23:30 +0100)
src/import/typedef.c
tests/import/typedef_fail.c [new file with mode: 0644]
tests/import/typedef_tmpl.c
tests/sh/import.sh

index a89617b07ed6cb0b12a56f83c25c99c440aada65..100ee8250e232924163a89772713a5507a4b10e9 100644 (file)
@@ -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 (file)
index 0000000..a81d793
--- /dev/null
@@ -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;
+}
index 2a48bedd8792878596aacf656a77f7f8eee26d07..b3ec7251d8876992bbc0d20a205dbc363d541605 100644 (file)
@@ -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;
 }
index 0d4e04505bea7271d457b3216344c112143e1e33..ca0a55f6db3e1a9c1d9f63e5f2caad3832dee36c 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# [test] #61
+# [test] #62
 
 n=0
 [ "$1" ] && n="$1"