Author: aschnell Date: Mon Sep 17 18:59:05 2007 New Revision: 7276 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7276&view=rev Log: - use ZYpp Url class - added testcases Added: trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.rb (with props) trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.ref.out trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.rb (with props) trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.ref.out Modified: trunk/libzypp-bindings/package/libzypp-bindings.changes trunk/libzypp-bindings/swig/Url.i trunk/libzypp-bindings/swig/zypp.i trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp trunk/libzypp-testsuite/pokus/src/testsuite.rb trunk/libzypp-testsuite/pokus/tests/pool-tests/add-remove1.rb Modified: trunk/libzypp-bindings/package/libzypp-bindings.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/package/libzypp-bindings.changes?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-bindings/package/libzypp-bindings.changes (original) +++ trunk/libzypp-bindings/package/libzypp-bindings.changes Mon Sep 17 18:59:05 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Sep 17 18:58:53 CEST 2007 - aschnell@suse.de + +- generate Perl bindings +- use ZYpp Url class + +------------------------------------------------------------------- Mon Sep 3 16:49:07 CEST 2007 - schwab@suse.de - Fix broken compiler flags. Modified: trunk/libzypp-bindings/swig/Url.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/Url.i?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-bindings/swig/Url.i (original) +++ trunk/libzypp-bindings/swig/Url.i Mon Sep 17 18:59:05 2007 @@ -1,22 +1,20 @@ -#ifdef SWIGRUBY +#if defined(SWIGPYTHON) || defined(SWIGRUBY) +%rename Url::asString "__str__"; +#endif -/* new(scheme, userinfo, host, port, registry, path, opaque, query, fragment, arg_check = false) */ +class Url +{ +public: -%typemap(in) const Url & { - VALUE urlstring = rb_funcall( $input, rb_intern("to_s"), 0, 0); - Url *u = new Url( (RSTRING(urlstring)->ptr) ); - $1 = u; -} - -%typemap(freearg) const Url & { - delete $1; -} - -%typemap(out) Url { - VALUE rburlstr = rb_str_new2($1.asString().c_str()); - $result = rburlstr ; -} + Url(); + ~Url(); -#endif + Url(const std::string& encodedUrl); + + bool isValid() const; + + std::string asString() const; + +}; Modified: trunk/libzypp-bindings/swig/zypp.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/zypp.i?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-bindings/swig/zypp.i (original) +++ trunk/libzypp-bindings/swig/zypp.i Mon Sep 17 18:59:05 2007 @@ -3,10 +3,10 @@ #ifdef SWIGPERL5 %{ #undef NORMAL - #undef readdir - #undef Fflush - #undef Mkdir -%} + #undef readdir + #undef Fflush + #undef Mkdir +%} #endif %{ Modified: trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp (original) +++ trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp Mon Sep 17 18:59:05 2007 @@ -54,6 +54,11 @@ set result "" set oops [catch { set result [exec sh -c $command] } catched] + if { $expect_to_fail == 1 } { + xfail $testBase_name + continue + } + if {$oops != 0} { fail "test case failed for $testBase_name: $catched" set errorOccured 0 @@ -63,11 +68,6 @@ normalise_logfile $dircase/$tmperrfile normalise_logfile $dircase/$tmpoutfile - if { $expect_to_fail == 1 } { - xfail $testBase_name - continue - } - # check optional referr if { [ file exists $dircase/$referrfile ] != 0 } { if { [ diff $dircase/$referrfile $dircase/$tmperrfile ] != 1 } { Modified: trunk/libzypp-testsuite/pokus/src/testsuite.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/src/testsuite.rb?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-testsuite/pokus/src/testsuite.rb (original) +++ trunk/libzypp-testsuite/pokus/src/testsuite.rb Mon Sep 17 18:59:05 2007 @@ -69,7 +69,7 @@ repo_info.set_name("Testsuite Repo") repo_info.set_enabled(true) repo_info.set_autorefresh(false) - repo_info.add_base_url(url) + repo_info.add_base_url(Url.new(url)) repo_manager.add_repository(repo_info) Added: trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.rb?rev=7276&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.rb Mon Sep 17 18:59:05 2007 @@ -0,0 +1,21 @@ +#!/usr/bin/ruby + + +# Specify a broken URL. + + +require '../../src/testsuite' + + +Testsuite.set_arch("x86_64") + +begin + pool = Testsuite.read_repo("htp://site/repo/") +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.ref.out?rev=7276&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/parse-tests/url1.ref.out Mon Sep 17 18:59:05 2007 @@ -0,0 +1,4 @@ +ZYppException caught +History: + - Unsupported URL scheme in URL: htp://site/repo/ +Error trying to read from htp://site/repo/ Added: trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.rb?rev=7276&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.rb Mon Sep 17 18:59:05 2007 @@ -0,0 +1,21 @@ +#!/usr/bin/ruby + + +# Specify a broken URL. + + +require '../../src/testsuite' + + +Testsuite.set_arch("x64_64") + +begin + pool = Testsuite.read_repo("http:site/repo") +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.ref.out?rev=7276&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/parse-tests/url2.ref.out Mon Sep 17 18:59:05 2007 @@ -0,0 +1,2 @@ +ZYppException caught +Url scheme requires a host component Modified: trunk/libzypp-testsuite/pokus/tests/pool-tests/add-remove1.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/pool-tests/add-remove1.rb?rev=7276&r1=7275&r2=7276&view=diff ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/pool-tests/add-remove1.rb (original) +++ trunk/libzypp-testsuite/pokus/tests/pool-tests/add-remove1.rb Mon Sep 17 18:59:05 2007 @@ -56,7 +56,7 @@ repo_info1.set_name("Test Repo for Factory.") repo_info1.set_enabled(true) repo_info1.set_autorefresh(false) -repo_info1.add_base_url("file://" + path1) +repo_info1.add_base_url(Url.new("file://" + path1)) repo_manager.add_repository(repo_info1) repo_manager.refresh_metadata(repo_info1) repo_manager.build_cache(repo_info1) @@ -67,7 +67,7 @@ repo_info2.set_name("Test Repo for Factory.") repo_info2.set_enabled(true) repo_info2.set_autorefresh(false) -repo_info2.add_base_url("file://" + path2) +repo_info2.add_base_url(Url.new("file://" + path2)) repo_manager.add_repository(repo_info2) repo_manager.refresh_metadata(repo_info2) repo_manager.build_cache(repo_info2) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org