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
9e9c8ae3
Commit
9e9c8ae3
authored
9 years ago
by
Rolf Eike Beer
Browse files
Options
Downloads
Patches
Plain Diff
SystemTools: extend test coverage of SystemTools::MakeDirectory()
Change-Id: I45efddc1638965d17f0207cdf900a44aef8bf0e8
parent
9596e98d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testSystemTools.cxx
+48
-0
48 additions, 0 deletions
testSystemTools.cxx
with
48 additions
and
0 deletions
testSystemTools.cxx
+
48
−
0
View file @
9e9c8ae3
...
...
@@ -172,6 +172,46 @@ static bool CheckFileOperations()
<<
testNewDir
<<
std
::
endl
;
res
=
false
;
}
// calling it again should just return true
if
(
!
kwsys
::
SystemTools
::
MakeDirectory
(
testNewDir
))
{
std
::
cerr
<<
"Problem with second call to MakeDirectory for: "
<<
testNewDir
<<
std
::
endl
;
res
=
false
;
}
// calling with 0 pointer should return false
if
(
kwsys
::
SystemTools
::
MakeDirectory
(
0
))
{
std
::
cerr
<<
"Problem with MakeDirectory(0)"
<<
std
::
endl
;
res
=
false
;
}
// calling with an empty string should return false
if
(
kwsys
::
SystemTools
::
MakeDirectory
(
std
::
string
()))
{
std
::
cerr
<<
"Problem with MakeDirectory(std::string())"
<<
std
::
endl
;
res
=
false
;
}
// remove it
if
(
!
kwsys
::
SystemTools
::
RemoveADirectory
(
testNewDir
))
{
std
::
cerr
<<
"Problem with RemoveADirectory for: "
<<
testNewDir
<<
std
::
endl
;
res
=
false
;
}
// create it using the char* version
if
(
!
kwsys
::
SystemTools
::
MakeDirectory
(
testNewDir
.
c_str
()))
{
std
::
cerr
<<
"Problem with second call to MakeDirectory as C string for: "
<<
testNewDir
<<
std
::
endl
;
res
=
false
;
}
if
(
!
kwsys
::
SystemTools
::
Touch
(
testNewFile
.
c_str
(),
true
))
{
...
...
@@ -180,6 +220,14 @@ static bool CheckFileOperations()
<<
testNewFile
<<
std
::
endl
;
res
=
false
;
}
// calling MakeDirectory with something that is no file should fail
if
(
kwsys
::
SystemTools
::
MakeDirectory
(
testNewFile
))
{
std
::
cerr
<<
"Problem with to MakeDirectory for: "
<<
testNewFile
<<
std
::
endl
;
res
=
false
;
}
// Reset umask
#if defined(_WIN32) && !defined(__CYGWIN__)
...
...
This diff is collapsed.
Click to expand it.
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