Go to the documentation of this file.00001 #include <boost/test/auto_unit_test.hpp>
00002
00003 #include "testsuite.hh"
00004 #include <boost/filesystem/path.hpp>
00005 #include <utilmm/configfile/pkgconfig.hh>
00006 #include <iostream>
00007
00008 using namespace utilmm;
00009 using namespace boost::filesystem;
00010
00011 BOOST_AUTO_TEST_CASE( test_exists )
00012 {
00013 path testdir = path(__FILE__).branch_path();
00014 #if BOOST_VERSION >= 104600
00015 setenv("PKG_CONFIG_PATH", testdir.string().c_str(), 1);
00016 #else
00017 setenv("PKG_CONFIG_PATH", testdir.native_file_string().c_str(), 1);
00018 #endif
00019
00020
00021 BOOST_REQUIRE_THROW(new pkgconfig("doesnotexist"), not_found);
00022
00023 pkgconfig pc("test_pkgconfig");
00024
00025
00026 BOOST_REQUIRE( pc.name() == "test_pkgconfig" );
00027 BOOST_REQUIRE( pc.version() == "0.1" );
00028 BOOST_REQUIRE( pc.get("prefix", "") == "/opt" );
00029 BOOST_REQUIRE( pc.get("bla", "") == "");
00030 BOOST_REQUIRE( pc.compiler() == "-DB21R -I/opt/include/test" );
00031 BOOST_REQUIRE( pc.compiler(pkgconfig::Path) == "-I/opt/include/test" );
00032 BOOST_REQUIRE( pc.compiler(pkgconfig::Other) == "-DB21R" );
00033 BOOST_REQUIRE( pc.linker() == "-L/opt/i386-linux/lib -lpkgconfig_test" );
00034 BOOST_REQUIRE( pc.linker(pkgconfig::Libraries) == "-lpkgconfig_test" );
00035 }
00036