From f06ff0b2d72489b938884b62d6075dbf7cb5601a Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 12 Oct 2019 00:16:27 +0200 Subject: [PATCH] :art: Still on import ... --- tests/import/class_template.c | 4 ---- tests/import/class_template_fail.c | 28 ++++++++++++++++++++++++++++ tests/import/func_fail.c | 20 ++++++++++++++++++++ tests/sh/import.sh | 2 +- 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 tests/import/class_template_fail.c create mode 100644 tests/import/func_fail.c diff --git a/tests/import/class_template.c b/tests/import/class_template.c index 79d677c7..80329369 100644 --- a/tests/import/class_template.c +++ b/tests/import/class_template.c @@ -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 index 00000000..2409024a --- /dev/null +++ b/tests/import/class_template_fail.c @@ -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 index 00000000..8227bff3 --- /dev/null +++ b/tests/import/func_fail.c @@ -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; +} diff --git a/tests/sh/import.sh b/tests/sh/import.sh index aec12dfb..e493fc23 100644 --- a/tests/sh/import.sh +++ b/tests/sh/import.sh @@ -1,5 +1,5 @@ #!/bin/bash -# [test] #45 +# [test] #47 n=0 [ "$1" ] && n="$1" -- 2.43.0