aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2006-12-02 13:31:17 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2006-12-02 13:31:17 +0000
commitfde5d0a8fe0d9ed36513aa8f3392de651c776533 (patch)
tree58c519854d92f3d34f8b5bd419a156efb6611f11
parent8ad318a237b9404600a420b878302b21fd332f8a (diff)
downloadpaludis-fde5d0a8fe0d9ed36513aa8f3392de651c776533.tar.gz
paludis-fde5d0a8fe0d9ed36513aa8f3392de651c776533.tar.xz
Add some aliases in ruby Paludis::QA and improve tests.
-rw-r--r--ruby/check.cc6
-rw-r--r--ruby/check_TEST.rb81
2 files changed, 69 insertions, 18 deletions
diff --git a/ruby/check.cc b/ruby/check.cc
index d63f555..b0a3615 100644
--- a/ruby/check.cc
+++ b/ruby/check.cc
@@ -241,18 +241,24 @@ namespace
rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_package_dir_check_maker);
rb_define_method(c_package_dir_check_maker, "keys", RUBY_FUNC_CAST(CheckMakerStruct<PackageDirCheckMaker>::keys),0);
rb_define_method(c_package_dir_check_maker, "find_maker", RUBY_FUNC_CAST(&package_dir_check_maker_find_maker),1);
+ rb_define_alias(c_package_dir_check_maker, "check_names", "keys");
+ rb_define_alias(c_package_dir_check_maker, "find_check", "find_maker");
c_file_check_maker = rb_define_class_under(paludis_qa_module(), "FileCheckMaker", rb_cObject);
rb_funcall(c_file_check_maker, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_file_check_maker);
rb_define_method(c_file_check_maker, "keys", RUBY_FUNC_CAST(CheckMakerStruct<FileCheckMaker>::keys),0);
rb_define_method(c_file_check_maker, "find_maker", RUBY_FUNC_CAST(&file_check_maker_find_maker),1);
+ rb_define_alias(c_file_check_maker, "check_names", "keys");
+ rb_define_alias(c_file_check_maker, "find_check", "find_maker");
c_ebuild_check_maker = rb_define_class_under(paludis_qa_module(), "EbuildCheckMaker", rb_cObject);
rb_funcall(c_ebuild_check_maker, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_funcall(rb_const_get(rb_cObject, rb_intern("Singleton")), rb_intern("included"), 1, c_ebuild_check_maker);
rb_define_method(c_ebuild_check_maker, "keys", RUBY_FUNC_CAST(&CheckMakerStruct<EbuildCheckMaker>::keys),0);
rb_define_method(c_ebuild_check_maker, "find_maker", RUBY_FUNC_CAST(&ebuild_check_maker_find_maker),1);
+ rb_define_alias(c_ebuild_check_maker, "check_names", "keys");
+ rb_define_alias(c_ebuild_check_maker, "find_check", "find_maker");
}
}
diff --git a/ruby/check_TEST.rb b/ruby/check_TEST.rb
index 90246a5..cdc9f0b 100644
--- a/ruby/check_TEST.rb
+++ b/ruby/check_TEST.rb
@@ -26,6 +26,10 @@ Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
module Paludis
module QA
class TestCase_FileCheckMaker < Test::Unit::TestCase
+ def instance
+ FileCheckMaker.instance
+ end
+
def test_instance
assert_equal FileCheckMaker.instance.__id__, FileCheckMaker.instance.__id__
assert_kind_of FileCheckMaker, FileCheckMaker.instance
@@ -38,22 +42,37 @@ module Paludis
end
def test_respond_to
- assert_respond_to FileCheckMaker.instance, :keys
- assert_respond_to FileCheckMaker.instance, :find_maker
+ assert_respond_to instance, :keys
+ assert_respond_to instance, :find_maker
+ assert_respond_to instance, :check_names
+ assert_respond_to instance, :find_check
end
def test_keys
- assert_kind_of Array, FileCheckMaker.instance.keys
- assert_not_equal 0, FileCheckMaker.instance.keys
+ assert_kind_of Array, instance.keys
+ assert_not_equal 0, instance.keys
end
def test_find_maker
- name = FileCheckMaker.instance.keys.first
- assert_kind_of FileCheck, FileCheckMaker.instance.find_maker(name)
+ name = instance.keys.first
+ assert_kind_of FileCheck, instance.find_maker(name)
+ end
+ def test_check_names
+ assert_kind_of Array, instance.check_names
+ assert_equal instance.keys, instance.check_names
+ end
+
+ def test_find_check
+ name = instance.keys.first
+ assert_equal instance.find_maker(name).describe, instance.find_check(name).describe
end
end
class TestCase_PackageDirCheckMaker < Test::Unit::TestCase
+ def instance
+ PackageDirCheckMaker.instance
+ end
+
def test_instance
assert_equal PackageDirCheckMaker.instance.__id__, PackageDirCheckMaker.instance.__id__
assert_kind_of PackageDirCheckMaker, PackageDirCheckMaker.instance
@@ -66,22 +85,37 @@ module Paludis
end
def test_respond_to
- assert_respond_to FileCheckMaker.instance, :keys
- assert_respond_to FileCheckMaker.instance, :find_maker
+ assert_respond_to instance, :keys
+ assert_respond_to instance, :find_maker
+ assert_respond_to instance, :check_names
+ assert_respond_to instance, :find_check
end
def test_keys
- assert_kind_of Array, PackageDirCheckMaker.instance.keys
- assert_not_equal 0, PackageDirCheckMaker.instance.keys
+ assert_kind_of Array, instance.keys
+ assert_not_equal 0, instance.keys
end
def test_find_maker
- name = PackageDirCheckMaker.instance.keys.first
- assert_kind_of PackageDirCheck, PackageDirCheckMaker.instance.find_maker(name)
+ name = instance.keys.first
+ assert_kind_of PackageDirCheck, instance.find_maker(name)
+ end
+ def test_check_names
+ assert_kind_of Array, instance.check_names
+ assert_equal instance.keys, instance.check_names
+ end
+
+ def test_find_check
+ name = instance.keys.first
+ assert_equal instance.find_maker(name).describe, instance.find_check(name).describe
end
end
class TestCase_EbuildCheckMaker < Test::Unit::TestCase
+ def instance
+ EbuildCheckMaker.instance
+ end
+
def test_instance
assert_equal EbuildCheckMaker.instance.__id__, EbuildCheckMaker.instance.__id__
assert_kind_of EbuildCheckMaker, EbuildCheckMaker.instance
@@ -94,18 +128,29 @@ module Paludis
end
def test_respond_to
- assert_respond_to FileCheckMaker.instance, :keys
- assert_respond_to FileCheckMaker.instance, :find_maker
+ assert_respond_to instance, :keys
+ assert_respond_to instance, :find_maker
+ assert_respond_to instance, :check_names
+ assert_respond_to instance, :find_check
end
def test_keys
- assert_kind_of Array, EbuildCheckMaker.instance.keys
- assert_not_equal 0, EbuildCheckMaker.instance.keys
+ assert_kind_of Array, instance.keys
+ assert_not_equal 0, instance.keys
end
def test_find_maker
- name = EbuildCheckMaker.instance.keys.first
- assert_kind_of EbuildCheck, EbuildCheckMaker.instance.find_maker(name)
+ name = instance.keys.first
+ assert_kind_of EbuildCheck, instance.find_maker(name)
+ end
+ def test_check_names
+ assert_kind_of Array, instance.check_names
+ assert_equal instance.keys, instance.check_names
+ end
+
+ def test_find_check
+ name = instance.keys.first
+ assert_equal instance.find_maker(name).describe, instance.find_check(name).describe
end
end