Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Utils
KWSys
Commits
97f880e6
Commit
97f880e6
authored
4 years ago
by
Dmitry Kalinkin
Committed by
Brad King
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Directory: add extra tests involving errorMessage
parent
f33ef4e3
No related branches found
Branches containing commit
No related tags found
1 merge request
!187
Glob: issue warnings on Directory errors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testDirectory.cxx
+35
-2
35 additions, 2 deletions
testDirectory.cxx
with
35 additions
and
2 deletions
testDirectory.cxx
+
35
−
2
View file @
97f880e6
...
...
@@ -57,7 +57,11 @@ int _doLongPathTest()
Directory
testdir
;
// Set res to failure if the directory doesn't load
res
+=
!
testdir
.
Load
(
testdirpath
);
std
::
string
errorMessage
=
""
;
res
+=
!
testdir
.
Load
(
testdirpath
,
&
errorMessage
);
if
(
errorMessage
!=
""
)
{
std
::
cerr
<<
"Failed to list directory: "
<<
errorMessage
<<
std
::
endl
;
}
// Increment res failure if the directory appears empty
res
+=
testdir
.
GetNumberOfFiles
()
==
0
;
// Increment res failures if the path has changed from
...
...
@@ -73,6 +77,34 @@ int _doLongPathTest()
return
res
;
}
int
_nonExistentDirectoryTest
()
{
using
namespace
kwsys
;
int
res
=
0
;
std
::
string
testdirpath
(
TEST_SYSTEMTOOLS_BINARY_DIR
"/directory_testing/doesnt_exist/"
);
std
::
string
errorMessage
;
Directory
testdir
;
errorMessage
=
"foo"
;
// Increment res failure if directory lists
res
+=
testdir
.
Load
(
testdirpath
,
&
errorMessage
);
#if !defined(_WIN32) || defined(__CYGWIN__)
// Increment res failure if errorMessage is unmodified
res
+=
(
errorMessage
==
"foo"
);
#endif
errorMessage
=
"foo"
;
// Increment res failure if directory has files
res
+=
(
testdir
.
GetNumberOfFilesInDirectory
(
testdirpath
,
&
errorMessage
)
>
0
);
#if !defined(_WIN32) || defined(__CYGWIN__)
// Increment res failure if errorMessage is unmodified
res
+=
(
errorMessage
==
"foo"
);
#endif
return
res
;
}
int
_copyDirectoryTest
()
{
using
namespace
kwsys
;
...
...
@@ -106,5 +138,6 @@ int _copyDirectoryTest()
int
testDirectory
(
int
,
char
*
[])
{
return
_doLongPathTest
()
+
_copyDirectoryTest
();
return
_doLongPathTest
()
+
_nonExistentDirectoryTest
()
+
_copyDirectoryTest
();
}
This diff is collapsed.
Click to expand it.
Brad King
@brad.king
mentioned in commit
8ff18ed7
·
4 years ago
mentioned in commit
8ff18ed7
mentioned in commit 8ff18ed72cb8a6f97ffb9680ce57e860670b3a39
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment