void TestAppend(void) { m_empty->Append(L"some/append\\path/"); m_directory->Append(L"some/append\\path/file"); m_path->Append(L".new.ext"); // Check correct parsing of folder and file name for empy paths, // folder only paths and paths with bor filename and folders. #if defined(WIN32) CPPUNIT_ASSERT(m_empty->GetDirectory() == L"some\\append\\path\\"); CPPUNIT_ASSERT(m_empty->GetFilename() == L""); CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir\\some\\append\\path\\"); CPPUNIT_ASSERT(m_directory->GetFilename() == L"file"); CPPUNIT_ASSERT(m_path->GetDirectory() == L"some\\path\\"); CPPUNIT_ASSERT(m_path->GetFilename() == L"file.ext.new.ext"); #else CPPUNIT_ASSERT(m_empty->GetDirectory() == L"some/append/path/"); CPPUNIT_ASSERT(m_empty->GetFilename() == L""); CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir/some/append/path/"); CPPUNIT_ASSERT(m_directory->GetFilename() == L"file"); CPPUNIT_ASSERT(m_path->GetDirectory() == L"some/path/"); CPPUNIT_ASSERT(m_path->GetFilename() == L"file.ext.new.ext"); #endif // Check for correct exception when folder separators in append string and path // already has a file name. SCXUNIT_RESET_ASSERTION(); CPPUNIT_ASSERT_THROW(m_path->Append(L"path/with\\file"), SCXCoreLib::SCXInvalidArgumentException); SCXUNIT_ASSERTIONS_FAILED(2); // both in append function and in SCXInvalidArgumentException constructor m_empty->Append(L"/double/"); // Check that any starting folder separators are removed if appending to existing folder. #if defined(WIN32) CPPUNIT_ASSERT(m_empty->GetDirectory().find(L"\\\\") == std::wstring::npos); #else CPPUNIT_ASSERT(m_empty->GetDirectory().find(L"//") == std::wstring::npos); #endif }