summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/test/TestFileUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/utils/test/TestFileUtils.cpp')
-rw-r--r--xbmc/utils/test/TestFileUtils.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/xbmc/utils/test/TestFileUtils.cpp b/xbmc/utils/test/TestFileUtils.cpp
new file mode 100644
index 0000000..720e82d
--- /dev/null
+++ b/xbmc/utils/test/TestFileUtils.cpp
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#include "filesystem/File.h"
10#include "test/TestUtils.h"
11#include "utils/FileUtils.h"
12
13#include <gtest/gtest.h>
14
15TEST(TestFileUtils, DeleteItem_CFileItemPtr)
16{
17 XFILE::CFile *tmpfile;
18 std::string tmpfilepath;
19
20 ASSERT_NE(nullptr, (tmpfile = XBMC_CREATETEMPFILE("")));
21 tmpfilepath = XBMC_TEMPFILEPATH(tmpfile);
22
23 CFileItemPtr item(new CFileItem(tmpfilepath));
24 item->SetPath(tmpfilepath);
25 item->m_bIsFolder = false;
26 item->Select(true);
27 tmpfile->Close(); //Close tmpfile before we try to delete it
28 EXPECT_TRUE(CFileUtils::DeleteItem(item));
29}
30
31TEST(TestFileUtils, DeleteItemString)
32{
33 XFILE::CFile *tmpfile;
34
35 ASSERT_NE(nullptr, (tmpfile = XBMC_CREATETEMPFILE("")));
36 tmpfile->Close(); //Close tmpfile before we try to delete it
37 EXPECT_TRUE(CFileUtils::DeleteItem(XBMC_TEMPFILEPATH(tmpfile)));
38}
39
40/* Executing RenameFile() requires input from the user */
41// static bool RenameFile(const std::string &strFile);