From d3ce3e78bd909a65fdc3da2b5ea5cc66d061d390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 23 Jun 2012 15:52:35 +0200 Subject: [PATCH] Uninitialized variables: Added test case --- test/testuninitvar.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 9cda7dbe4..3ef04b875 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -317,12 +317,22 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); - checkUninitVar("A a()\n" - "{\n" - " A ret;\n" - " return ret;\n" - "}\n"); - ASSERT_EQUALS("", errout.str()); + { + checkUninitVar("A a()\n" + "{\n" + " A ret;\n" + " return ret;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + + checkUninitVar("A a()\n" + "{\n" + " A ret;\n" + " return ret;\n" + "}\n", + "test.c"); + ASSERT_EQUALS("[test.c:4]: (error) Uninitialized variable: ret\n", errout.str()); + } checkUninitVar("int a()\n" "{\n"