]> Nishi Git Mirror - gwion.git/commitdiff
:art: More testing
authorfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 22 Oct 2019 10:09:44 +0000 (12:09 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 22 Oct 2019 10:09:44 +0000 (12:09 +0200)
src/lib/import.c
tests/import/fptr_tmpl_fail.c
tests/import/func_tmpl.gw
tests/import/func_tmpl_fail.c [new file with mode: 0644]
tests/sh/import.sh

index 735a9a77c8bff53c907614b2d3c620594588388f..4df6d1e29167ab967808ccc9ad302ee919fca4e3 100644 (file)
@@ -158,13 +158,15 @@ ANN static m_bool tmpl_list(const Gwion gwion, struct tmpl_checker *ck) {
       if(!i || s[i+1] != '>')
         break;
       c[i] = '\0';
-      ck->list = new_id_list(gwion->mp, insert_symbol(gwion->st, c), ck->pos);
+      ck->list = new_id_list(gwion->mp, insert_symbol(gwion->st, c),
+          loc_cpy(gwion->mp, ck->pos));
       return GW_OK;
     }
     if(s[i] == ',') {
       if(!i)break;
       c[i] = '\0';
-      ck->list = new_id_list(gwion->mp, insert_symbol(gwion->st, c), ck->pos);
+      ck->list = new_id_list(gwion->mp, insert_symbol(gwion->st, c),
+          loc_cpy(gwion->mp, ck->pos));
       struct tmpl_checker _ck = { .str=ck->str + i + 1, .pos=ck->pos };
       CHECK_BB(tmpl_list(gwion, &_ck))
       ck->list->next = _ck.list;
@@ -681,7 +683,7 @@ ANN static Fptr_Def import_fptr(const Gwi gwi, DL_Func* dl_fun, ae_flag flag) {
 }
 
 ANN Type gwi_fptr_end(const Gwi gwi, const ae_flag flag) {
-  const Fptr_Def fptr = import_fptr(gwi, &gwi->func, flag);
+  DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi, &gwi->func, flag))
   const m_bool ret = traverse_fptr_def(gwi->gwion->env, fptr);
   if(ret > 0)
     SET_FLAG(fptr->base->func, builtin);
index 696ed9834dbf4fb18dfec3135396d83e8c2e8338..03a311bad08983d86f5da8817188f3c77a37c88f 100644 (file)
 #include "operator.h"
 #include "import.h"
 
-static MFUN(test_func) { puts("test"); }
 GWION_IMPORT(typedef_test) {
-  Type t_func_typedef;
-  GWI_OB((t_func_typedef = gwi_mk_type(gwi, "FuncTypedef", SZ_INT , NULL)))
-  GWI_BB(gwi_fptr_ini(gwi, "int", "<~A.~>test"))
+  GWI_BB(gwi_fptr_ini(gwi, "int~", "<~A~>test"))
   GWI_OB(gwi_fptr_end(gwi, 0))
   return GW_OK;
 }
index a963bb528b1d2fb89913dcde02ba688565e72109..4866c00949d6fdf9e55f58e2494feae3242a4d15 100644 (file)
@@ -1,2 +1,2 @@
 test<~int~>(1);
-#!test(1);
+test(1);
diff --git a/tests/import/func_tmpl_fail.c b/tests/import/func_tmpl_fail.c
new file mode 100644 (file)
index 0000000..338c5f7
--- /dev/null
@@ -0,0 +1,23 @@
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "instr.h"
+#include "object.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+#include "instr.h"
+
+static SFUN(func_tmpl_xfun) {
+  
+}
+
+GWION_IMPORT(func_tmpl) {
+  GWI_BB(gwi_func_ini(gwi, "voit", "<~A~>test", func_tmpl_xfun))
+  GWI_BB(gwi_func_end(gwi, 0))
+  return GW_OK;
+}
index 921183dc7eda112485bcc2a0d1995981f3a20eaa..6edaf1a99c9148367c20245c440ae0577fac5bd0 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# [test] #59
+# [test] #60
 
 n=0
 [ "$1" ] && n="$1"