From b9b8d511aa0904550ca1292c074fcf76fda0fc0d Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sat, 6 Apr 2019 14:13:34 +0200 Subject: [PATCH] tests: Add "unassigned local variable in while" test --- tests/Makefile.am | 1 + .../control-flow/unassigned-local-variable-while.test | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/control-flow/unassigned-local-variable-while.test diff --git a/tests/Makefile.am b/tests/Makefile.am index ce19144f7..e61c65b18 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -164,6 +164,7 @@ TESTS = \ control-flow/unassigned-captured-local-variable.test \ control-flow/unassigned-local-block-variable.test \ control-flow/unassigned-local-variable.test \ + control-flow/unassigned-local-variable-while.test \ control-flow/while-false.vala \ control-flow/bug628336.vala \ control-flow/bug639482.vala \ diff --git a/tests/control-flow/unassigned-local-variable-while.test b/tests/control-flow/unassigned-local-variable-while.test new file mode 100644 index 000000000..d036a56b7 --- /dev/null +++ b/tests/control-flow/unassigned-local-variable-while.test @@ -0,0 +1,11 @@ +Invalid Code + +void main () { + bool cond = false; + + string s; + while (cond) { + s = "foo"; + } + print ("%s", s); +} -- 2.47.3