From 448aa3b0517a48bf1eb23e143716a1d2543f0ee2 Mon Sep 17 00:00:00 2001 From: Daniel_Cortez Date: Fri, 5 Jul 2019 19:10:25 +0700 Subject: [PATCH] Update tests for __emit --- source/compiler/tests/__emit.inc | 1 + source/compiler/tests/__emit_p6.meta | 21 +++++++++++---------- source/compiler/tests/__emit_p6.pwn | 4 +++- source/compiler/tests/__emit_p7.meta | 24 +++++++++++++----------- source/compiler/tests/__emit_p7.pwn | 7 +++++-- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/source/compiler/tests/__emit.inc b/source/compiler/tests/__emit.inc index 834ec6d..3febc1e 100644 --- a/source/compiler/tests/__emit.inc +++ b/source/compiler/tests/__emit.inc @@ -3,5 +3,6 @@ const global_const = 0; new stock global_var = 0; new stock global_array[2]; +new stock const global_const_var = 0; forward global_func(); public global_func() { return 0; } native global_native(const string[]) = print; diff --git a/source/compiler/tests/__emit_p6.meta b/source/compiler/tests/__emit_p6.meta index d747d6d..81b62b3 100644 --- a/source/compiler/tests/__emit_p6.meta +++ b/source/compiler/tests/__emit_p6.meta @@ -9,17 +9,18 @@ __emit_p6.pwn(45) : error 022: must be lvalue (non-constant) __emit_p6.pwn(46) : error 022: must be lvalue (non-constant) __emit_p6.pwn(47) : error 022: must be lvalue (non-constant) __emit_p6.pwn(48) : error 022: must be lvalue (non-constant) -__emit_p6.pwn(49) : error 033: array must be indexed (variable "local_array") -__emit_p6.pwn(50) : error 033: array must be indexed (variable "local_refarray") -__emit_p6.pwn(69) : error 022: must be lvalue (non-constant) -__emit_p6.pwn(70) : error 022: must be lvalue (non-constant) +__emit_p6.pwn(49) : error 022: must be lvalue (non-constant) +__emit_p6.pwn(50) : error 033: array must be indexed (variable "local_array") +__emit_p6.pwn(51) : error 033: array must be indexed (variable "local_refarray") __emit_p6.pwn(71) : error 022: must be lvalue (non-constant) __emit_p6.pwn(72) : error 022: must be lvalue (non-constant) -__emit_p6.pwn(73) : error 033: array must be indexed (variable "local_array") -__emit_p6.pwn(74) : error 033: array must be indexed (variable "local_refarray") -__emit_p6.pwn(96) : error 076: syntax error in the expression, or invalid function call -__emit_p6.pwn(97) : error 076: syntax error in the expression, or invalid function call -__emit_p6.pwn(98) : error 033: array must be indexed (variable "local_array") -__emit_p6.pwn(99) : error 033: array must be indexed (variable "local_refarray") +__emit_p6.pwn(73) : error 022: must be lvalue (non-constant) +__emit_p6.pwn(74) : error 022: must be lvalue (non-constant) +__emit_p6.pwn(75) : error 033: array must be indexed (variable "local_array") +__emit_p6.pwn(76) : error 033: array must be indexed (variable "local_refarray") +__emit_p6.pwn(98) : error 076: syntax error in the expression, or invalid function call +__emit_p6.pwn(99) : error 076: syntax error in the expression, or invalid function call +__emit_p6.pwn(100) : error 033: array must be indexed (variable "local_array") +__emit_p6.pwn(101) : error 033: array must be indexed (variable "local_refarray") """ } diff --git a/source/compiler/tests/__emit_p6.pwn b/source/compiler/tests/__emit_p6.pwn index 0e9a543..ca09b7b 100644 --- a/source/compiler/tests/__emit_p6.pwn +++ b/source/compiler/tests/__emit_p6.pwn @@ -45,6 +45,7 @@ stock test__op_stor_u_pri_alt(&local_refvar, local_refarray[]) emit stor.u.pri global_const; emit stor.u.pri global_func; emit stor.u.pri global_native; + emit stor.u.pri global_const_var; emit stor.u.pri local_const; emit stor.u.pri local_array; emit stor.u.pri local_refarray; @@ -59,6 +60,7 @@ stock test__op_addr_u_pri_alt(&local_refvar, local_refarray[]) // ok emit addr.u.pri global_var; + emit addr.u.pri global_const_var; emit addr.u.pri local_var; emit addr.u.pri local_static_var; emit addr.u.pri local_refvar; @@ -104,7 +106,7 @@ main() { new t, a[2]; test__op_load_u_pri_alt(t, a); // 4 - test__op_stor_u_pri_alt(t, a); // 6 + test__op_stor_u_pri_alt(t, a); // 7 test__op_addr_u_pri_alt(t, a); // 6 test__push_u(t, a); // 4 } diff --git a/source/compiler/tests/__emit_p7.meta b/source/compiler/tests/__emit_p7.meta index e32da8a..a9c185f 100644 --- a/source/compiler/tests/__emit_p7.meta +++ b/source/compiler/tests/__emit_p7.meta @@ -1,25 +1,27 @@ { 'test_type': 'output_check', 'errors': """ -__emit_p7.pwn(20) : error 022: must be lvalue (non-constant) __emit_p7.pwn(21) : error 022: must be lvalue (non-constant) __emit_p7.pwn(22) : error 022: must be lvalue (non-constant) __emit_p7.pwn(23) : error 022: must be lvalue (non-constant) -__emit_p7.pwn(24) : error 033: array must be indexed (variable "local_array") -__emit_p7.pwn(25) : error 033: array must be indexed (variable "local_refarray") -__emit_p7.pwn(26) : error 035: argument type mismatch (argument 1) +__emit_p7.pwn(24) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(25) : error 033: array must be indexed (variable "local_array") +__emit_p7.pwn(26) : error 033: array must be indexed (variable "local_refarray") __emit_p7.pwn(27) : error 035: argument type mismatch (argument 1) -__emit_p7.pwn(46) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(28) : error 035: argument type mismatch (argument 1) __emit_p7.pwn(47) : error 022: must be lvalue (non-constant) __emit_p7.pwn(48) : error 022: must be lvalue (non-constant) __emit_p7.pwn(49) : error 022: must be lvalue (non-constant) -__emit_p7.pwn(50) : error 033: array must be indexed (variable "local_array") -__emit_p7.pwn(51) : error 033: array must be indexed (variable "local_refarray") -__emit_p7.pwn(70) : error 022: must be lvalue (non-constant) -__emit_p7.pwn(71) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(50) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(51) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(52) : error 033: array must be indexed (variable "local_array") +__emit_p7.pwn(53) : error 033: array must be indexed (variable "local_refarray") __emit_p7.pwn(72) : error 022: must be lvalue (non-constant) __emit_p7.pwn(73) : error 022: must be lvalue (non-constant) -__emit_p7.pwn(74) : error 033: array must be indexed (variable "local_array") -__emit_p7.pwn(75) : error 033: array must be indexed (variable "local_refarray") +__emit_p7.pwn(74) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(75) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(76) : error 022: must be lvalue (non-constant) +__emit_p7.pwn(77) : error 033: array must be indexed (variable "local_array") +__emit_p7.pwn(78) : error 033: array must be indexed (variable "local_refarray") """ } diff --git a/source/compiler/tests/__emit_p7.pwn b/source/compiler/tests/__emit_p7.pwn index 65e7773..0ee4e44 100644 --- a/source/compiler/tests/__emit_p7.pwn +++ b/source/compiler/tests/__emit_p7.pwn @@ -10,6 +10,7 @@ stock test__push_u_adr(&local_refvar, local_refarray[]) // ok emit push.u.adr global_var; + emit push.u.adr global_const_var; emit push.u.adr local_refvar; emit push.u.adr local_var; emit push.u.adr local_static_var; @@ -46,6 +47,7 @@ stock test__zero_u(&local_refvar, local_refarray[]) emit zero.u global_const; emit zero.u global_func; emit zero.u global_native; + emit zero.u global_const_var; emit zero.u local_const; emit zero.u local_array; emit zero.u local_refarray; @@ -70,6 +72,7 @@ stock test__inc_dec_u(&local_refvar, local_refarray[]) emit inc.u global_const; emit inc.u global_func; emit inc.u global_native; + emit inc.u global_const_var; emit inc.u local_const; emit inc.u local_array; emit inc.u local_refarray; @@ -80,6 +83,6 @@ main() { new t, a[2]; test__push_u_adr(t, a); // 8 - test__zero_u(t, a); // 6 - test__inc_dec_u(t, a); // 6 + test__zero_u(t, a); // 7 + test__inc_dec_u(t, a); // 7 }