6 #include <boost/test/unit_test.hpp>
8 #include "zypp/ZYppFactory.h"
10 #include "zypp/PathInfo.h"
11 #include "zypp/TmpPath.h"
12 #include "zypp/ZConfig.h"
13 #include "zypp/repo/RepoVariables.h"
19 using namespace boost::unit_test;
20 using namespace zypp::repo;
22 #define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/yum/data")
24 BOOST_AUTO_TEST_CASE(replace_text)
26 /* check RepoVariablesStringReplacer */
28 RepoVariablesStringReplacer replacer1;
30 BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar"),
31 "http://foo/"+ ZConfig::instance().systemArchitecture().asString() + "/bar");
33 getZYpp()->setArchitecture(Arch("i686"));
34 BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar/$basearch"),
35 "http://foo/i686/bar/i386");
37 /* check RepoVariablesUrlReplacer */
39 RepoVariablesUrlReplacer replacer2;
41 BOOST_CHECK_EQUAL(replacer2(Url("ftp://user:secret@site.org/$arch/")).asCompleteString(),
42 "ftp://user:secret@site.org/i686/");
44 BOOST_CHECK_EQUAL(replacer2(Url("http://user:my$arch@site.org/$basearch/")).asCompleteString(),
45 "http://user:my$arch@site.org/i386/");
47 BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/?arch=$arch")).asCompleteString(),
48 "http://site.org/update/?arch=i686");
51 // vim: set ts=2 sts=2 sw=2 ai et: