Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
31ed1339
Commit
31ed1339
authored
Oct 21, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dir_name tests
parent
9a68bd8c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
tests/test_create_dir.cpp
tests/test_create_dir.cpp
+32
-1
No files found.
tests/test_create_dir.cpp
View file @
31ed1339
...
...
@@ -23,5 +23,36 @@ TEST_CASE("create_dir", "[create_dir]")
test_create_dir
(
"./test_logs/dir1/dir3"
,
"test_logs/dir1/dir3"
);
test_create_dir
(
"test_logs/../test_logs/dir1/dir4"
,
"test_logs/dir1/dir4"
);
test_create_dir
(
"./test_logs/dir1/dir2/dir99/../dir23"
,
"test_logs/dir1/dir2/dir23"
);
spdlog
::
drop
(
"test-create-dir"
);
}
TEST_CASE
(
"dir_name"
,
"[create_dir]"
)
{
using
spdlog
::
details
::
os
::
dir_name
;
REQUIRE
(
dir_name
(
""
).
empty
());
REQUIRE
(
dir_name
(
"dir"
).
empty
());
REQUIRE
(
dir_name
(
"dir/"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir///"
)
==
"dir//"
);
REQUIRE
(
dir_name
(
"dir/file"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir/file.txt"
)
==
"dir"
);
REQUIRE
(
dir_name
(
"dir/file.txt/"
)
==
"dir/file.txt"
);
REQUIRE
(
dir_name
(
"/dir/file.txt"
)
==
"/dir"
);
REQUIRE
(
dir_name
(
"//dir/file.txt"
)
==
"//dir"
);
REQUIRE
(
dir_name
(
"//dir/file.txt"
)
==
"//dir"
);
REQUIRE
(
dir_name
(
"../file.txt"
)
==
".."
);
REQUIRE
(
dir_name
(
"./file.txt"
)
==
"."
);
#ifdef WIN32
REQUIRE
(
dir_name
(
R"(dir\)"
)
==
"dir"
);
REQUIRE
(
dir_name
(
R"(dir\\\)"
)
==
"dir//"
);
REQUIRE
(
dir_name
(
R"(dir\file)"
)
==
"dir"
);
REQUIRE
(
dir_name
(
R"(dir\file.txt)"
)
==
"dir"
);
REQUIRE
(
dir_name
(
R"(dir\file.txt\)"
)
==
"dir/file.txt"
);
REQUIRE
(
dir_name
(
R"(\dir\file.txt)"
)
==
"/dir"
);
REQUIRE
(
dir_name
(
R"(\\dir\file.txt)"
)
==
"//dir"
);
REQUIRE
(
dir_name
(
R"(\\dir\file.txt)"
)
==
"//dir"
);
REQUIRE
(
dir_name
(
R"(..\file.txt)"
)
==
".."
);
REQUIRE
(
dir_name
(
R"(.\file.txt)"
)
==
"."
);
REQUIRE
(
dir_name
(
R"(c:\\a\b\c\d\file.txt)"
)
==
"c://a/b/c/d"
);
//REQUIRE(dir_name(R"(c:\\a)") == "c://");
#endif
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment