diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-12-22 13:50:20 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-12-30 13:03:54 +0000 |
commit | 8f4e16f014c820a0ecb85e28453b88c277bc859f (patch) | |
tree | 4306d07620ffba72e844da12431c9ac94beb402a | |
parent | 0ed053245702d193b9c0ad7d8bda9e975ddfb6ed (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>
-rw-r--r-- | test/file.cpp | 5 |
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; |