From: Rico Tzschichholz Date: Thu, 5 Jan 2023 11:29:28 +0000 (+0100) Subject: tests: Add "one-line declaration of local variables" test to increase coverage X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8812129a8d912a9343dccb34f8d7126071f6ec19;p=thirdparty%2Fvala.git tests: Add "one-line declaration of local variables" test to increase coverage --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 577b926d1..20a6fe780 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -971,6 +971,7 @@ TESTS = \ parser/invalid-statement-delimiter.test \ parser/local-variable.vala \ parser/local-variable-array-type-invalid.test \ + parser/local-variable-multi-one-line.vala \ parser/lock-statement.vala \ parser/main-block.vala \ parser/main-block-minimal.vala \ diff --git a/tests/parser/local-variable-multi-one-line.c-expected b/tests/parser/local-variable-multi-one-line.c-expected new file mode 100644 index 000000000..943cf79a8 --- /dev/null +++ b/tests/parser/local-variable-multi-one-line.c-expected @@ -0,0 +1,29 @@ +/* parser_local_variable_multi_one_line.c generated by valac, the Vala compiler + * generated from parser_local_variable_multi_one_line.vala, do not modify */ + +#include +#include + +static void _vala_main (void); + +static void +_vala_main (void) +{ + gint a = 0; + gint b[2] = {0}; + gint _tmp0_[2] = {0}; + gint c = 0; + _tmp0_[0] = 23; + _tmp0_[1] = 42; + memcpy (b, _tmp0_, 2 * sizeof (gint)); + c = 4711; +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + diff --git a/tests/parser/local-variable-multi-one-line.vala b/tests/parser/local-variable-multi-one-line.vala new file mode 100644 index 000000000..7ef51ea18 --- /dev/null +++ b/tests/parser/local-variable-multi-one-line.vala @@ -0,0 +1,3 @@ +void main () { + int a, b[2] = { 23, 42 }, c = 4711; +}