aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2006-12-10 11:11:55 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2006-12-10 11:11:55 +0000
commit3a3961cefa4aeb180075f49b3ed8a7b6302a35c3 (patch)
tree8201bfbf470db90f25c11cf62b68dab0202f5c3a
parenteb29f47953dffd5fb4f877fe16d786365f4663a6 (diff)
downloadpaludis-3a3961cefa4aeb180075f49b3ed8a7b6302a35c3.tar.gz
paludis-3a3961cefa4aeb180075f49b3ed8a7b6302a35c3.tar.xz
Add RepositoryInfoSection.header to ruby binding.
-rw-r--r--ruby/repository.cc9
-rw-r--r--ruby/repository_TEST.rb25
2 files changed, 34 insertions, 0 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 8cea3cb..24f1e41 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -257,6 +257,14 @@ namespace
}
VALUE
+ repository_info_section_header(VALUE self)
+ {
+ RepositoryInfoSection::ConstPointer * self_ptr;
+ Data_Get_Struct(self, RepositoryInfoSection::ConstPointer, self_ptr);
+ return rb_str_new2((*self_ptr)->heading().c_str());
+ }
+
+ VALUE
repository_contents(VALUE self, VALUE qpn, VALUE vs)
{
try
@@ -366,6 +374,7 @@ namespace
c_repository_info_section = rb_define_class_under(paludis_module(), "RepositoryInfoSection", rb_cObject);
rb_funcall(c_repository_info_section, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_repository_info_section, "kvs", RUBY_FUNC_CAST(&repository_info_section_kvs), 0);
+ rb_define_method(c_repository_info_section, "header", RUBY_FUNC_CAST(&repository_info_section_header), 0);
}
}
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index efe4294..8148ef1 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -198,5 +198,30 @@ module Paludis
assert_kind_of Time, time
end
end
+
+ class TestCase_RepositoryInfo < Test::Unit::TestCase
+ include RepositoryTestCase
+
+ def test_info
+ assert_kind_of RepositoryInfo, repo.info(false)
+ assert_kind_of RepositoryInfo, repo.info(true)
+ end
+
+ def test_sections
+ assert_kind_of Array, repo.info(false).sections
+ assert_equal 1, repo.info(false).sections.length
+ end
+
+ def test_section_header
+ assert_kind_of String, repo.info(false).sections.first.header
+ assert_equal 'Configuration information', repo.info(false).sections.first.header
+ end
+
+ def test_section_kvs
+ assert_kind_of Hash, repo.info(false).sections.first.kvs
+ assert_equal 'portage', repo.info(false).sections.first.kvs['format']
+ assert_equal 'vdb', installed_repo.info(false).sections.first.kvs['format']
+ end
+ end
end