From fa16181e840ef106dea3957714cd1147923c5dbe Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Wed, 4 May 2011 14:40:14 +0000 Subject: [PATCH] Fix build error in tests. Don't call wrealpath on the value returned by GetArg0, since it breaks the tests and changes the semantics of that function. This was SVN commit r9427. --- source/ps/GameSetup/CmdLineArgs.cpp | 6 ++---- source/ps/GameSetup/tests/test_CmdLineArgs.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/ps/GameSetup/CmdLineArgs.cpp b/source/ps/GameSetup/CmdLineArgs.cpp index 285c2eeae1..457f4e0a7f 100644 --- a/source/ps/GameSetup/CmdLineArgs.cpp +++ b/source/ps/GameSetup/CmdLineArgs.cpp @@ -16,11 +16,9 @@ */ #include "precompiled.h" + #include "CmdLineArgs.h" -#include "lib/sysdep/filesystem.h" // wrealpath - - CmdLineArgs::CmdLineArgs(int argc, const char* argv[]) { if (argc >= 1) @@ -29,7 +27,7 @@ CmdLineArgs::CmdLineArgs(int argc, const char* argv[]) // avoid OsPath complaining about mixing both types of separators, // which happens when running in the VC2010 debugger std::replace(arg0.begin(), arg0.end(), '\\', '/'); - m_Arg0 = wrealpath(arg0); + m_Arg0 = arg0; } for (int i = 1; i < argc; ++i) diff --git a/source/ps/GameSetup/tests/test_CmdLineArgs.h b/source/ps/GameSetup/tests/test_CmdLineArgs.h index 0e77745413..26bcc02067 100644 --- a/source/ps/GameSetup/tests/test_CmdLineArgs.h +++ b/source/ps/GameSetup/tests/test_CmdLineArgs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Wildfire Games. +/* Copyright (C) 2011 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,7 +19,7 @@ #include "ps/GameSetup/CmdLineArgs.h" -class TestCmdLineArgs : public CxxTest::TestSuite +class TestCmdLineArgs : public CxxTest::TestSuite { public: void test_has() @@ -78,9 +78,13 @@ public: { const char* argv[] = { "program" }; CmdLineArgs c(ARRAY_SIZE(argv), argv); - TS_ASSERT_STR_EQUALS(c.GetArg0(), "program"); + TS_ASSERT_WSTR_EQUALS(c.GetArg0().string(), L"program"); CmdLineArgs c2(0, NULL); - TS_ASSERT_STR_EQUALS(c2.GetArg0(), ""); + TS_ASSERT_WSTR_EQUALS(c2.GetArg0().string(), L""); + + const char* argv3[] = { "ab/cd\\ef\\gh/../ij" }; + CmdLineArgs c3(ARRAY_SIZE(argv3), argv3); + TS_ASSERT_WSTR_EQUALS(c3.GetArg0().string(), L"ab/cd/ef/gh/../ij"); } };