libcruft-util/test/exe.cpp

30 lines
792 B
C++
Raw Normal View History

#include "../tap.hpp"
2016-05-13 15:23:05 +10:00
#include "../exe.hpp"
2016-10-10 16:23:07 +11:00
#include <experimental/filesystem>
2016-10-10 16:23:07 +11:00
///////////////////////////////////////////////////////////////////////////////
2016-05-13 15:23:05 +10:00
int
main (int, char **argv)
2016-05-13 15:23:05 +10:00
{
cruft::TAP::logger tap;
// we'd like to compare based on the total path, but systems like msys2
// have varying styles of paths and it's difficult to harmonize the
// expected and queried values.
//
// so we compare the filename instead under the assumption that it should
// be stable across path styles.
auto const query = cruft::image_path ();
auto const truth = std::experimental::filesystem::path (argv[0]);
tap.expect_eq (
query.stem (),
truth.stem (),
"identify executable path # %!", query
);
2016-10-10 16:23:07 +11:00
return tap.status ();
2016-05-13 15:23:05 +10:00
}