diff options
author | Eric Albright <eric_albright@sil.org> | 2008-05-02 06:02:12 +0000 |
---|---|---|
committer | Eric Albright <eric_albright@sil.org> | 2008-05-02 06:02:12 +0000 |
commit | 0ed48af1f728561b45969096c698e900a600028e (patch) | |
tree | 515de40a8deb904efb97a90330c5c77f4585bfb7 /unittests/EnchantTestFixture.h | |
parent | f04f81e52d73fce51d5f2451bd0a2825b8c15caa (diff) | |
download | enchant-0ed48af1f728561b45969096c698e900a600028e.tar.gz |
Fixes case where if a personal dictionary was edited such that it didn't end with a trailing new line, adding a word would not work correctly.
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@23735 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
Diffstat (limited to 'unittests/EnchantTestFixture.h')
-rw-r--r-- | unittests/EnchantTestFixture.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/unittests/EnchantTestFixture.h b/unittests/EnchantTestFixture.h index 64daae4..e0d860d 100644 --- a/unittests/EnchantTestFixture.h +++ b/unittests/EnchantTestFixture.h @@ -32,7 +32,7 @@ #include <shlwapi.h>
#endif
#include <io.h>
-
+#include <assert.h>
#include <glib.h>
#include <string>
@@ -143,7 +143,7 @@ struct EnchantTestFixture {
std::string toTheSideDir = dir + OUT_OF_THE_WAY;
- if(!DirExists(toTheSideDir))
+ if(DirExists(dir) && !DirExists(toTheSideDir))
{
MoveDir(dir, toTheSideDir);
}
@@ -156,6 +156,7 @@ struct EnchantTestFixture std::string toTheSideDir = dir + OUT_OF_THE_WAY;
if(DirExists(toTheSideDir))
{
+ DeleteDirAndFiles(dir);
MoveDir(toTheSideDir, dir);
}
}
@@ -167,12 +168,13 @@ struct EnchantTestFixture static bool DirExists(const std::string& dir)
{
- return g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR);
+ return g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR) != 0;
}
static void MoveDir(const std::string& from, const std::string& to)
{
int result = g_rename(from.c_str(), to.c_str());
+ assert(result);
if(result)
{
perror("failed");
|