diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-01-05 12:29:28 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-01-05 12:32:31 +0100 |
commit | 8812129a8d912a9343dccb34f8d7126071f6ec19 (patch) | |
tree | a5859fd798cff75b46a18e10fa4dc7e2b7204d7f /tests | |
parent | f156de68664e919ee5ad1aa9f6b811512e75122c (diff) | |
download | vala-8812129a8d912a9343dccb34f8d7126071f6ec19.tar.gz |
tests: Add "one-line declaration of local variables" test to increase coverage
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/parser/local-variable-multi-one-line.c-expected | 29 | ||||
-rw-r--r-- | tests/parser/local-variable-multi-one-line.vala | 3 |
3 files changed, 33 insertions, 0 deletions
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 <glib.h> +#include <string.h> + +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; +} |