mirror of
https://github.com/bkaradzic/bx.git
synced 2026-08-09 23:09:38 +00:00
Added scanner. (#410)
This commit is contained in:
committed by
GitHub
parent
cd6720ce9a
commit
9916e720fc
@@ -64,6 +64,15 @@ FilePathTest s_filePathTest[] =
|
||||
|
||||
{"abc\\/../..\\/././../def", "../../def"},
|
||||
{"\\abc/def\\../..\\..", "/"},
|
||||
|
||||
// Drive letter
|
||||
{"c:", "C:"},
|
||||
{"c:/", "C:/"},
|
||||
{"c:abc", "C:/abc"},
|
||||
{"c:/abc/../def", "C:/def"},
|
||||
{"c:/..", "C:/"},
|
||||
{"c:/../..", "C:/"},
|
||||
{"c:\\abc\\..\\def", "C:/def"},
|
||||
};
|
||||
|
||||
struct FilePathSplit
|
||||
@@ -118,6 +127,25 @@ TEST_CASE("FilePath", "[filepath][string]")
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("FilePath sub-view", "[filepath]")
|
||||
{
|
||||
const char buffer[] = "C:/abc";
|
||||
|
||||
bx::FilePath fp;
|
||||
fp.set(bx::StringView(buffer, 2) );
|
||||
REQUIRE(0 == bx::strCmp("C:", fp) );
|
||||
|
||||
const char buffer2[] = "ab/cd";
|
||||
fp.set(bx::StringView(buffer2, 2) );
|
||||
REQUIRE(0 == bx::strCmp("ab", fp) );
|
||||
|
||||
fp.set(bx::StringView(buffer2, 3) );
|
||||
REQUIRE(0 == bx::strCmp("ab/", fp) );
|
||||
|
||||
fp.set(bx::StringView(buffer2, 0) );
|
||||
REQUIRE(0 == bx::strCmp(".", fp) );
|
||||
}
|
||||
|
||||
TEST_CASE("FilePath temp", "[filepath]")
|
||||
{
|
||||
bx::FilePath tmp(bx::Dir::Temp);
|
||||
|
||||
Reference in New Issue
Block a user