From 9debcb84cdea41b53f1333d02eaad5b7128aca56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 19 Jul 2010 22:02:51 +0200 Subject: [PATCH] filelocation-refactoring: Fixed unit tests in windows --- test/testcppcheck.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index a881db5f4..c3f40ca7a 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -23,6 +23,7 @@ #include "cppcheck.h" #include "testsuite.h" +#include "path.h" #include #include @@ -384,8 +385,9 @@ private: ErrorLogger::ErrorMessage::FileLocation loc; loc.setfile("ab/cd/../ef.h"); errorMessage._callStack.push_back(loc); - ASSERT_EQUALS("", errorMessage.toXML()); - ASSERT_EQUALS("[ab/ef.h:0]: ", errorMessage.toString()); + const std::string fname(Path::toNativeSeparators("ab/ef.h")); + ASSERT_EQUALS("", errorMessage.toXML()); + ASSERT_EQUALS("[" + fname + ":0]: ", errorMessage.toString()); } void templateFormat() @@ -398,9 +400,10 @@ private: errorMessage._id = "testId"; errorMessage._severity = Severity::fromString("error"); errorMessage._msg = "long testMessage"; - ASSERT_EQUALS("", errorMessage.toXML()); - ASSERT_EQUALS("[some/{file}file.cpp:10]: (error) long testMessage", errorMessage.toString()); - ASSERT_EQUALS("testId-some/{file}file.cpp,error.10?{long testMessage}", errorMessage.toString("{id}-{file},{severity}.{line}?{{message}}")); + const std::string fname(Path::toNativeSeparators("some/{file}file.cpp")); + ASSERT_EQUALS("", errorMessage.toXML()); + ASSERT_EQUALS("[" + fname + ":10]: (error) long testMessage", errorMessage.toString()); + ASSERT_EQUALS("testId-" + fname + ",error.10?{long testMessage}", errorMessage.toString("{id}-{file},{severity}.{line}?{{message}}")); } void getErrorMessages()