Go to the documentation of this file.00001 #include <boost/test/auto_unit_test.hpp>
00002
00003 #include "testsuite.hh"
00004 #include <utilmm/configfile/shell_expand.hh>
00005
00006 #include <sys/types.h>
00007 #include <unistd.h>
00008 #include <pwd.h>
00009
00010 #include <string>
00011
00012 static std::string get_home()
00013 {
00014
00015 uid_t uid = getuid();
00016 passwd* pwd;
00017 while((pwd = getpwent()))
00018 {
00019 if(pwd->pw_uid == uid)
00020 break;
00021 }
00022
00023 endpwent();
00024 if (pwd)
00025 return pwd->pw_dir;
00026 else
00027 return std::string();
00028
00029 }
00030
00031 BOOST_AUTO_TEST_CASE( test_expansion )
00032 {
00033 std::string home = get_home();
00034 std::string expanded = utilmm::shell_expand("$HOME");
00035 BOOST_REQUIRE(home == expanded);
00036 }
00037