]> Nishi Git Mirror - gwion.git/commitdiff
:art: Still on import ...
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 11 Oct 2019 22:16:27 +0000 (00:16 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 11 Oct 2019 22:16:27 +0000 (00:16 +0200)
tests/import/class_template.c
tests/import/class_template_fail.c [new file with mode: 0644]
tests/import/func_fail.c [new file with mode: 0644]
tests/sh/import.sh

index 79d677c7244332998cbd561edd2ed62b377c85d9..80329369733f27660c4bb074cd9da97749fe271d 100644 (file)
@@ -38,10 +38,6 @@ GWION_IMPORT(class_template) {
     GWI_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL)))
     GWI_BB(gwi_item_ini(gwi, "B[]", "value"))
     GWI_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL)))
-
-
-    /*gwi_func_ini(gwi, "B", "set", class_template_set);*/
-    /*gwi_func_end(gwi, ae_flag_member);*/
   GWI_BB(gwi_class_end(gwi))
   return GW_OK;
 }
diff --git a/tests/import/class_template_fail.c b/tests/import/class_template_fail.c
new file mode 100644 (file)
index 0000000..2409024
--- /dev/null
@@ -0,0 +1,28 @@
+#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"
+#include "gwi.h"
+
+GWION_IMPORT(class_template_fail) {
+  Type t_fail;
+  const m_str list[2] = { "A", "B" };
+  gwi_tmpl_ini(gwi, 2, list);
+  GWI_OB((t_fail = gwi_mk_type(gwi, "ClassTemplate", SZ_INT, "Object")))
+  GWI_BB(gwi_class_ini(gwi, t_fail, NULL, NULL))
+  gwi_tmpl_end(gwi);
+  gwi_tmpl_ini(gwi, 2, list);
+  GWI_BB(gwi_func_ini(gwi, "int", "test", (f_xfun)1))
+  GWI_BB(gwi_func_end(gwi, ae_flag_none))
+  gwi_tmpl_end(gwi);
+  GWI_BB(gwi_class_end(gwi))
+  return GW_OK;
+}
diff --git a/tests/import/func_fail.c b/tests/import/func_fail.c
new file mode 100644 (file)
index 0000000..8227bff
--- /dev/null
@@ -0,0 +1,20 @@
+#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"
+
+GWION_IMPORT(too_many_args) {
+  GWI_BB(gwi_func_ini(gwi, "int", "test", (f_xfun)1))
+  GWI_BB(gwi_func_arg(gwi, "Int", "i"))
+  GWI_BB(gwi_func_end(gwi, 0))
+  return GW_OK;
+}
index aec12dfb7f0d1dcbaaf493d78d6a2d93f1311a65..e493fc23195371aa7d769558271bafdf1b355bb3 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# [test] #45
+# [test] #47
 
 n=0
 [ "$1" ] && n="$1"