Esempio n. 1
0
    void TestSetFileSuffix(void)
    {
        m_directory->SetFilesuffix(L"new");
        m_file->SetFilesuffix(L"new");
        m_path->SetFilesuffix(L"new");

        // Check no suffix added when file name is empty.
        CPPUNIT_ASSERT(m_directory->GetFilename() == L"");
        // Check file name is changed.
        CPPUNIT_ASSERT(m_file->GetFilename() == L"file.new");
        // Check file suffix is added.
        CPPUNIT_ASSERT(m_path->GetFilename() == L"file.new");
        // Make sure original directories are preserved.
#if defined(WIN32)
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir\\");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some\\path\\");
#else
        CPPUNIT_ASSERT(m_directory->GetDirectory() == L"dir/");
        CPPUNIT_ASSERT(m_file->GetDirectory() == L"");
        CPPUNIT_ASSERT(m_path->GetDirectory() == L"some/path/");
#endif
        // make sure a suffix can be removed (including suffix separator)
        m_file->SetFilesuffix(L"");
        CPPUNIT_ASSERT(m_file->GetFilename() == L"file");
    }