$search
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 setenv("PKG_CONFIG_PATH", testdir.native_file_string().c_str(), 1); 00015 00016 // Check for a non-existent pc file 00017 BOOST_REQUIRE_THROW(new pkgconfig("doesnotexist"), not_found); 00018 // Check for an existent pc file 00019 pkgconfig pc("test_pkgconfig"); 00020 00021 // Check the data 00022 BOOST_REQUIRE( pc.name() == "test_pkgconfig" ); 00023 BOOST_REQUIRE( pc.version() == "0.1" ); 00024 BOOST_REQUIRE( pc.get("prefix", "") == "/opt" ); 00025 BOOST_REQUIRE( pc.get("bla", "") == ""); 00026 BOOST_REQUIRE( pc.compiler() == "-DB21R -I/opt/include/test" ); 00027 BOOST_REQUIRE( pc.compiler(pkgconfig::Path) == "-I/opt/include/test" ); 00028 BOOST_REQUIRE( pc.compiler(pkgconfig::Other) == "-DB21R" ); 00029 BOOST_REQUIRE( pc.linker() == "-L/opt/i386-linux/lib -lpkgconfig_test" ); 00030 BOOST_REQUIRE( pc.linker(pkgconfig::Libraries) == "-lpkgconfig_test" ); 00031 } 00032