summaryrefslogtreecommitdiff
path: root/test/file.cpp
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-12-22 13:50:20 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-12-30 13:03:54 +0000
commit8f4e16f014c820a0ecb85e28453b88c277bc859f (patch)
tree4306d07620ffba72e844da12431c9ac94beb402a /test/file.cpp
parent0ed053245702d193b9c0ad7d8bda9e975ddfb6ed (diff)
test: file: Check that directories are not treated as files
Directories can not be opened as a file, so the exists() check should not return true for a path which points to a directory. Directories are not handled by the File class. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/file.cpp')
-rw-r--r--test/file.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/file.cpp b/test/file.cpp
index f458f355..b80667ae 100644
--- a/test/file.cpp
+++ b/test/file.cpp
@@ -49,6 +49,11 @@ protected:
return TestFail;
}
+ if (File::exists("/dev")) {
+ cerr << "Directories should not be treated as files" << endl;
+ return TestFail;
+ }
+
/* Test unnamed file. */
File file;