bool
path_starts_with(std::string_view path, std::string_view prefix)
{
+ if (path.empty()) {
+ return false;
+ }
for (size_t i = 0, j = 0; i < path.length() && j < prefix.length();
++i, ++j) {
#ifdef _WIN32
# -------------------------------------------------------------------------
TEST "Enabled CCACHE_BASEDIR"
+ CCACHE_BASEDIR=/ $CCACHE_COMPILE --version
+ expect_stat no_input_file 1
+
cd dir1
CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -c src/test.c
expect_stat direct_cache_hit 0
TEST_CASE("util::path_starts_with")
{
+ CHECK(!util::path_starts_with("", ""));
+ CHECK(!util::path_starts_with("", "/"));
CHECK(util::path_starts_with("/foo/bar", "/foo"));
CHECK(!util::path_starts_with("/batz/bar", "/foo"));
CHECK(!util::path_starts_with("/foo/bar", "/foo/baz"));