diff --git a/Makefile b/Makefile
index ba923e03b..2eff14854 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ TESTOBJ = test/testbufferoverrun.o \
test/testcharvar.o \
test/testclass.o \
test/testconstructors.o \
+ test/testcppcheck.o \
test/testdangerousfunctions.o \
test/testdivision.o \
test/testfilelister.o \
@@ -117,7 +118,7 @@ src/cppcheck.o: src/cppcheck.cpp src/cppcheck.h src/settings.h src/errorlogger.h
src/cppcheckexecutor.o: src/cppcheckexecutor.cpp src/cppcheckexecutor.h src/errorlogger.h src/cppcheck.h src/settings.h src/checkfunctionusage.h src/tokenize.h src/token.h
g++ $(CXXFLAGS) -c -o src/cppcheckexecutor.o src/cppcheckexecutor.cpp
-src/errormessage.o: src/errormessage.cpp src/errormessage.h src/settings.h src/tokenize.h src/errorlogger.h src/token.h
+src/errormessage.o: src/errormessage.cpp src/errormessage.h src/settings.h src/errorlogger.h src/tokenize.h src/token.h
g++ $(CXXFLAGS) -c -o src/errormessage.o src/errormessage.cpp
src/filelister.o: src/filelister.cpp src/filelister.h
@@ -150,6 +151,9 @@ test/testclass.o: test/testclass.cpp src/tokenize.h src/settings.h src/errorlogg
test/testconstructors.o: test/testconstructors.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h test/testsuite.h
g++ $(CXXFLAGS) -c -o test/testconstructors.o test/testconstructors.cpp
+test/testcppcheck.o: test/testcppcheck.cpp test/testsuite.h src/errorlogger.h src/cppcheck.h src/settings.h src/checkfunctionusage.h src/tokenize.h src/token.h
+ g++ $(CXXFLAGS) -c -o test/testcppcheck.o test/testcppcheck.cpp
+
test/testdangerousfunctions.o: test/testdangerousfunctions.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkdangerousfunctions.h test/testsuite.h
g++ $(CXXFLAGS) -c -o test/testdangerousfunctions.o test/testdangerousfunctions.cpp
diff --git a/cppcheck.cbp b/cppcheck.cbp
index 79e576ae1..d387d89b0 100644
--- a/cppcheck.cbp
+++ b/cppcheck.cbp
@@ -66,6 +66,7 @@
+
diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp
new file mode 100644
index 000000000..25dcba7f7
--- /dev/null
+++ b/test/testcppcheck.cpp
@@ -0,0 +1,69 @@
+/*
+ * Cppcheck - A tool for static C/C++ code analysis
+ * Copyright (C) 2007-2009 Daniel Marjamäki, Reijo Tomperi, Nicolas Le Cam,
+ * Leandro Penz, Kimmo Varis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+#include
+
+extern std::ostringstream errout;
+
+class TestCppcheck : public TestFixture
+{
+public:
+ TestCppcheck() : TestFixture("TestCppcheck")
+ { }
+
+private:
+
+ void check(const std::string &data)
+ {
+ errout.str("");
+ CppCheck cppCheck(*this);
+ cppCheck.addFile("file.cpp", data);
+ cppCheck.check();
+ }
+
+ void run()
+ {
+ // TEST_CASE(linenumbers);
+ }
+
+ void linenumbers()
+ {
+ const char filedata[] = "void f()\n"
+ "{\n"
+ " char *foo = new char[10];\n"
+ " delete [] foo;\n"
+ " foo[3] = 0;\n"
+ "}\n";
+ check(filedata);
+
+ // Compare results..
+ ASSERT_EQUALS("[file.cpp:5]: Using \"foo\" after it has been deallocated / released\n", errout.str());
+ }
+};
+
+REGISTER_TEST(TestCppcheck)