33 const char *c_home = std::getenv (
"HOME");
36 if (c_home ==
nullptr)
39 const std::string home (c_home);
42 SELF_CHECK (home == gdb_tilde_expand (
"~"));
47 SELF_CHECK (gdb_tilde_expand (
"~/non/existent/directory")
48 == home +
"/non/existent/directory");
52 SELF_CHECK (gdb_tilde_expand (
"~/*/a.out") == home +
"/*/a.out");
55 SELF_CHECK (gdb_tilde_expand (
"/some/abs/path") ==
"/some/abs/path");
56 SELF_CHECK (gdb_tilde_expand (
"relative/path") ==
"relative/path");
60 const char *c_user = std::getenv (
"USER");
61 if (c_user !=
nullptr)
63 const std::string user (c_user);
64 SELF_CHECK (gdb_tilde_expand ((
"~" + user).c_str ()) == home);
65 SELF_CHECK (gdb_tilde_expand ((
"~" + user +
"/a/b").c_str ())
73 gdb_tilde_expand (
"~no_one_should_have_that_login/a");
76 catch (
const gdb_exception_error &e)
78 SELF_CHECK (e.error == GENERIC_ERROR);
81 ==
"Could not find a match for '~no_one_should_have_that_login'.");