aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2008-01-11 09:27:57 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2008-01-11 09:27:57 +0000
commita8280639c004deef84a1809ddf9c037dafe71405 (patch)
tree0b055837df427ab73315996fe878fa3fb0095fd2
parentac1e81ac67c330c94f482764ead12cbebe73e9e3 (diff)
downloadpaludis-a8280639c004deef84a1809ddf9c037dafe71405.tar.gz
paludis-a8280639c004deef84a1809ddf9c037dafe71405.tar.xz
(ruby) Re-add DepList.add and re-enable DepListEntry tests.
-rw-r--r--ruby/dep_list.cc9
-rw-r--r--ruby/dep_list_TEST.rb69
2 files changed, 38 insertions, 40 deletions
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index 72c94f2..ad420fe 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -757,7 +757,6 @@ namespace
}
}
-#if CIARANM_REMOVED_THIS
/*
* call-seq:
* add(dep_spec, destinations)
@@ -773,12 +772,13 @@ namespace
Data_Get_Struct(self, DepList, p);
if (!rb_obj_is_kind_of(d, rb_cArray))
rb_raise(rb_eTypeError, "Can't convert %s into Array", rb_obj_classname(d));
- tr1::shared_ptr<DestinationsCollection> destinations(new DestinationsCollection::Concrete);
+ tr1::shared_ptr<DestinationsSet> destinations(new DestinationsSet);
for (long i = 0 ; i < RARRAY(d)->len ; ++i)
destinations->insert(value_to_repository(rb_ary_entry(d, i)));
- p->add(value_to_dep_spec(da), destinations);
+ const PackageDepSpec pds = *value_to_package_dep_spec(da);
+ p->add(pds, destinations);
return self;
}
catch (const std::exception & e)
@@ -786,7 +786,6 @@ namespace
exception_to_ruby_exception(e);
}
}
-#endif
/*
* call-seq:
@@ -1234,8 +1233,8 @@ namespace
rb_define_singleton_method(c_dep_list, "new", RUBY_FUNC_CAST(&dep_list_new), -1);
rb_define_method(c_dep_list, "initialize", RUBY_FUNC_CAST(&dep_list_init), -1);
rb_define_method(c_dep_list, "clear", RUBY_FUNC_CAST(&dep_list_clear), 0);
-#if CIARANM_REMOVED_THIS
rb_define_method(c_dep_list, "add", RUBY_FUNC_CAST(&dep_list_add), 2);
+#if CIARANM_REMOVED_THIS
rb_define_method(c_dep_list, "already_installed?", RUBY_FUNC_CAST(&dep_list_already_installed), 2);
#endif
rb_define_method(c_dep_list, "each", RUBY_FUNC_CAST(&dep_list_each), 0);
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index 9a606c6..dd8feb2 100644
--- a/ruby/dep_list_TEST.rb
+++ b/ruby/dep_list_TEST.rb
@@ -116,7 +116,7 @@ module Paludis
end
def pda
- PackageDepSpec.new('foo/bar', PackageDepSpecParseMode::Permissive)
+ Paludis::parse_user_package_dep_spec('foo/bar', [])
end
def dd
@@ -178,11 +178,11 @@ module Paludis
### [:add, :clear, :already_installed?, :each, :options].each {|sym| assert_respond_to dep_list, sym}
### end
-### def test_add
-### assert_nothing_raised do
-### dl.add(pda, dd)
-### end
-### end
+ def test_add
+ assert_nothing_raised do
+ dl.add(pda, dd)
+ end
+ end
def test_clear
assert_nothing_raised do
@@ -229,34 +229,33 @@ module Paludis
end
end
-### class TestCase_DepListEntry < Test::Unit::TestCase
-### include Shared
-###
-### def dle
-### dl.add(pda, dd).entries.first
-### end
-###
-### def test_create
-### assert_raise NoMethodError do
-### DepListEntry.new
-### end
-### end
-###
-### def test_methods
-### dep_list_entry = dle
-### {
-### :package => PackageDatabaseEntry, :metadata => VersionMetadata,
-### :state=> Integer, :tags => [String], :destinations => [Repository]
-### }.each_pair do |method, returns|
-### assert_respond_to dep_list_entry, method
-### if returns.kind_of? Array
-### assert_kind_of Array, dep_list_entry.send(method)
-### dep_list_entry.send(method).each {|x| assert_kind_of returns.first, x}
-### else
-### assert_kind_of returns, dep_list_entry.send(method)
-### end
-### end
-### end
-### end
+ class TestCase_DepListEntry < Test::Unit::TestCase
+ include Shared
+
+ def dle
+ dl.add(pda, dd).entries.first
+ end
+
+ def test_create
+ assert_raise NoMethodError do
+ DepListEntry.new
+ end
+ end
+
+ def test_methods
+ dep_list_entry = dle
+ {
+ :package_id => PackageID, :state=> Integer, :tags => [String]
+ }.each_pair do |method, returns|
+ assert_respond_to dep_list_entry, method
+ if returns.kind_of? Array
+ assert_kind_of Array, dep_list_entry.send(method)
+ dep_list_entry.send(method).each {|x| assert_kind_of returns.first, x}
+ else
+ assert_kind_of returns, dep_list_entry.send(method)
+ end
+ end
+ end
+ end
end