aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2006-11-30 23:59:29 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2006-11-30 23:59:29 +0000
commitf96b6b2995d72122a815883e5efe3d31b65a4959 (patch)
tree8c18638be3b68ad6e6d568634eb474f91f60df7b
parent4f647bca851ca6e306ee420706d8b29a1712a79b (diff)
downloadpaludis-f96b6b2995d72122a815883e5efe3d31b65a4959.tar.gz
paludis-f96b6b2995d72122a815883e5efe3d31b65a4959.tar.xz
Fix ruby exception messages. Add another QAEnvironment test.
-rw-r--r--ruby/check.cc4
-rw-r--r--ruby/dep_atom.cc3
-rw-r--r--ruby/environment.cc3
-rw-r--r--ruby/message.cc3
-rw-r--r--ruby/package_database_entry.cc3
-rw-r--r--ruby/qa_environment_TEST.rb11
-rw-r--r--ruby/qualified_package_name.cc3
-rw-r--r--ruby/version_metadata.cc3
-rw-r--r--ruby/version_spec.cc3
9 files changed, 20 insertions, 16 deletions
diff --git a/ruby/check.cc b/ruby/check.cc
index f5cc474..d63f555 100644
--- a/ruby/check.cc
+++ b/ruby/check.cc
@@ -323,9 +323,9 @@ paludis::ruby::value_to_ebuild_check_data(VALUE v)
}
else
{
- std::string message = "can't convert " + std::string(rb_obj_classname(v)) + " into EbuildCheckData";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into EbuildCheckData", rb_obj_classname(v));
}
}
+
RegisterRubyClass::Register paludis_ruby_register_check PALUDIS_ATTRIBUTE((used))
(&do_register_check);
diff --git a/ruby/dep_atom.cc b/ruby/dep_atom.cc
index e619766..65cac07 100644
--- a/ruby/dep_atom.cc
+++ b/ruby/dep_atom.cc
@@ -204,8 +204,7 @@ paludis::ruby::value_to_package_dep_atom(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into PackageDepAtom";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into PackageDepAtom", rb_obj_classname(v));
}
}
diff --git a/ruby/environment.cc b/ruby/environment.cc
index d98e1ed..d7b91e8 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -276,8 +276,7 @@ paludis::ruby::value_to_environment_data(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into Environment";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into EnvironmentData", rb_obj_classname(v));
}
}
diff --git a/ruby/message.cc b/ruby/message.cc
index ed0bc68..7903e99 100644
--- a/ruby/message.cc
+++ b/ruby/message.cc
@@ -109,8 +109,7 @@ paludis::ruby::value_to_message(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into Message";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into Message", rb_obj_classname(v));
}
}
diff --git a/ruby/package_database_entry.cc b/ruby/package_database_entry.cc
index 82748e6..2e8ee3e 100644
--- a/ruby/package_database_entry.cc
+++ b/ruby/package_database_entry.cc
@@ -177,8 +177,7 @@ paludis::ruby::value_to_package_database_entry(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into PackageDatabaseEntry";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into PackageDatabaseEntry", rb_obj_classname(v));
}
}
diff --git a/ruby/qa_environment_TEST.rb b/ruby/qa_environment_TEST.rb
index aecefd9..76a8254 100644
--- a/ruby/qa_environment_TEST.rb
+++ b/ruby/qa_environment_TEST.rb
@@ -28,6 +28,17 @@ module Paludis
class TestCase_QAEnvironment < Test::Unit::TestCase
def test_create
env = QAEnvironment.new('qa_environment_TEST_dir/repo1')
+ env = QAEnvironment.new('qa_environment_TEST_dir/repo1', '/var/empty')
+ end
+
+ def test_create_error
+ assert_raise ArgumentError do
+ env = QAEnvironment.new
+ end
+
+ assert_raise ArgumentError do
+ env = QAEnvironment.new("1","2","3")
+ end
end
def test_as_environment
diff --git a/ruby/qualified_package_name.cc b/ruby/qualified_package_name.cc
index 97dfb78..988c3a1 100644
--- a/ruby/qualified_package_name.cc
+++ b/ruby/qualified_package_name.cc
@@ -137,8 +137,7 @@ paludis::ruby::value_to_qualified_package_name(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into QualifiedPackageName";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into QualifiedPackageName", rb_obj_classname(v));
}
}
diff --git a/ruby/version_metadata.cc b/ruby/version_metadata.cc
index beddcdd..f1da8b2 100644
--- a/ruby/version_metadata.cc
+++ b/ruby/version_metadata.cc
@@ -196,8 +196,7 @@ paludis::ruby::value_to_version_metadata(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + " into VersionMetadata";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into VersionMetadata", rb_obj_classname(v));
}
}
diff --git a/ruby/version_spec.cc b/ruby/version_spec.cc
index 12e7133..f0ee77b 100644
--- a/ruby/version_spec.cc
+++ b/ruby/version_spec.cc
@@ -106,8 +106,7 @@ paludis::ruby::value_to_version_spec(VALUE v)
}
else
{
- std::string message = "TypeError: can't convert " + std::string(rb_obj_classname(v)) + "into VersionSpec";
- rb_raise(rb_eTypeError, message.c_str());
+ rb_raise(rb_eTypeError, "Can't convert %s into VersionSpec", rb_obj_classname(v));
}
}