OSDN Git Service

Fix a problem where tests in the "Test" configuration fail when run from Test Explorer.
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 May 2020 23:01:33 +0000 (08:01 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 26 May 2020 23:01:33 +0000 (08:01 +0900)
Src/Merge.cpp
Src/Test.cpp
Src/TestMain.cpp

index 935a4d8..c513061 100644 (file)
@@ -184,7 +184,11 @@ BOOL CMergeApp::InitInstance()
        env::LoadRegistryFromFile(paths::ConcatPath(env::GetProgPath(), _T("WinMerge.reg")));
 
        // Parse command-line arguments.
+#ifdef TEST_WINMERGE
+       MergeCmdLineInfo cmdInfo(_T(""));
+#else
        MergeCmdLineInfo cmdInfo(GetCommandLine());
+#endif
        if (cmdInfo.m_bNoPrefs)
                m_pOptions->SetSerializing(false); // Turn off serializing to registry.
 
index ebd73a3..c921574 100644 (file)
@@ -376,8 +376,9 @@ TEST(FolderCompare, IgnoreEOL)
 \r
 TEST(CommandLineTest, Desc)\r
 {\r
+       String progpath = paths::ConcatPath(env::GetProgPath(), _T("WinMergeU.exe"));\r
        String projectRoot = getProjectRoot();\r
-       MergeCmdLineInfo cmdInfo((String(GetCommandLineW()) + L" /dl TestL /dr TestR " + \r
+       MergeCmdLineInfo cmdInfo((progpath + L" /dl TestL /dr TestR " + \r
                paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UCS-2BE/DiffItem.h") + L" " + \r
                paths::ConcatPath(projectRoot, L"Testing/Data/Unicode/UCS-2LE/DiffItem.h")).c_str()\r
        );\r
@@ -392,8 +393,9 @@ TEST(CommandLineTest, Desc)
 \r
 TEST(CommandLineTest, Desc2)\r
 {\r
+       String progpath = paths::ConcatPath(env::GetProgPath(), _T("WinMergeU.exe"));\r
        String projectRoot = getProjectRoot();\r
-       MergeCmdLineInfo cmdInfo((String(GetCommandLineW()) + L" /dl TestL /dr TestR " + \r
+       MergeCmdLineInfo cmdInfo((progpath + L" /dl TestL /dr TestR " + \r
                paths::ConcatPath(projectRoot, L"Testing/Data/big_file.conflict")).c_str()\r
        );\r
        theApp.ParseArgsAndDoOpen(cmdInfo, GetMainFrame());\r
@@ -408,8 +410,9 @@ TEST(CommandLineTest, Desc2)
 \r
 TEST(CommandLineTest, Desc3)\r
 {\r
+       String progpath = paths::ConcatPath(env::GetProgPath(), _T("WinMergeU.exe"));\r
        String projectRoot = getProjectRoot();\r
-       MergeCmdLineInfo cmdInfo((String(GetCommandLineW()) + L" /dr TestR " + \r
+       MergeCmdLineInfo cmdInfo((progpath + L" /dr TestR " + \r
                paths::ConcatPath(projectRoot, L"Testing/Data/big_file.conflict")).c_str()\r
        );\r
        theApp.ParseArgsAndDoOpen(cmdInfo, GetMainFrame());\r
@@ -424,8 +427,9 @@ TEST(CommandLineTest, Desc3)
 \r
 TEST(CommandLineTest, Desc4)\r
 {\r
+       String progpath = paths::ConcatPath(env::GetProgPath(), _T("WinMergeU.exe"));\r
        String projectRoot = getProjectRoot();\r
-       MergeCmdLineInfo cmdInfo((String(GetCommandLineW()) + L" /dl TestL " + \r
+       MergeCmdLineInfo cmdInfo((progpath + L" /dl TestL " + \r
                paths::ConcatPath(projectRoot, L"Testing/Data/big_file.conflict")).c_str()\r
        );\r
        theApp.ParseArgsAndDoOpen(cmdInfo, GetMainFrame());\r
index a0ef1cc..454aa86 100644 (file)
@@ -15,6 +15,7 @@ void TestAll()
        for (const auto& key : GetOptionsMgr()->GetNameList())\r
                GetOptionsMgr()->Reset(key);\r
        RUN_ALL_TESTS();\r
+       PostQuitMessage(0);\r
 }\r
 \r
 }\r