Skip to content

Commit

Permalink
Merge pull request #3 from peelonet/testing
Browse files Browse the repository at this point in the history
Add more Windows test cases
  • Loading branch information
RauliL authored Sep 7, 2024
2 parents 58efecb + 5fbbab6 commit ae1f1dc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/test_single_paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ test_callback(
);
}

#if defined(_WIN32)
static void
test_home_dir_with_userprofile()
{
_putenv("HOME=");
_putenv("USERPROFILE=C:\\test");

assert(peelo::xdg::home_dir() == path("C:\\test"));
}

static void
test_home_dir_with_home_drive_and_path()
{
_putenv("HOME=");
_putenv("HOMEDRIVE=C:\\");
_putenv("HOMEPATH=test");

assert(peelo::xdg::home_dir() == path("C:\\test"));
}
#endif

int
main()
{
Expand Down Expand Up @@ -104,4 +125,8 @@ main()
runtime_dir<std::filesystem::path>,
"XDG_RUNTIME_DIR"
);
#if defined(_WIN32)
test_home_dir_with_userprofile();
test_home_dir_with_home_drive_and_path();
#endif
}

0 comments on commit ae1f1dc

Please sign in to comment.