using std::cout;
using std::endl;
using std::string;
+using std::map;
using namespace zypp;
using namespace zypp::parser;
using namespace boost::unit_test;
}
}
+void ini_read_test2(const string &dir)
+{
+ InputStream is((Pathname(dir)+"/2.ini"));
+ IniDict dict(is);
+
+ BOOST_CHECK( find( dict.sectionsBegin(), dict.sectionsEnd(), "base" ) != dict.sectionsEnd() );
+ //IniDict::entry_const_iterator i = find( dict.entriesBegin("base"), dict.entriesEnd("base"), "name");
+ //BOOST_CHECK( i != dict.entriesEnd("base") );
+}
+
test_suite*
init_unit_test_suite( int argc, char *argv[] )
{
std::string const params[] = { datadir };
test->add(BOOST_PARAM_TEST_CASE(&ini_read_test,
(std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE(&ini_read_test2,
+ (std::string const*)params, params+1));
return test;
}
virtual void consume( const std::string §ion, const std::string &key, const std::string &value )
{
- MIL << section << " | " << key << " | " << value << endl;
+ MIL << "'" << section << "'" << " | " << "'" << key << "'" << " | " << "'" << value << "'" << endl;
+ }
+};
+
+
+class WithSpacesTest : public IniParser
+{
+ virtual void consume( const std::string §ion )
+ {
+ MIL << section << endl;
+ }
+
+ virtual void consume( const std::string §ion, const std::string &key, const std::string &value )
+ {
+ MIL << "'" << section << "'" << " | " << "'" << key << "'" << " | " << "'" << value << "'" << endl;
+ if ( section == "base")
+ {
+ if ( key == "name" )
+ BOOST_CHECK_EQUAL( value, "foo" );
+ }
}
};
parser.parse(is);
}
+void ini_spaces_test(const string &dir)
+{
+ InputStream is((Pathname(dir)+"/2.ini"));
+ WithSpacesTest parser;
+ parser.parse(is);
+}
+
test_suite*
init_unit_test_suite( int argc, char *argv[] )
{
std::string const params[] = { datadir };
test->add(BOOST_PARAM_TEST_CASE(&ini_read_test,
(std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE(&ini_spaces_test,
+ (std::string const*)params, params+1));
return test;
}
std::ostream & RepoInfo::dumpRepoOn( std::ostream & str ) const
{
str << "[" << alias() << "]" << endl;
- str << "name = " << name() << endl;
+ str << "name=" << name() << endl;
if ( ! baseUrls().empty() )
- str << "baseurl = ";
+ str << "baseurl=";
for ( urls_const_iterator it = baseUrlsBegin();
it != baseUrlsEnd();
++it )
{
str << *it << endl;
}
- str << "mirrorlist = " << mirrorListUrl() << endl;
- str << "type = " << type().asString() << endl;
- str << "enabled = " << (enabled() ? "1" : "0") << endl;
+ str << "mirrorlist=" << mirrorListUrl() << endl;
+ str << "type=" << type().asString() << endl;
+ str << "enabled=" << (enabled() ? "1" : "0") << endl;
return str;
}