aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-23 06:55:52 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-23 06:55:52 +0000
commit91684c275c862aebc7272b7907a092a525b6f7c9 (patch)
treef20013d112e63452a4788212255fc02dc05e52e0
parent0eefce7be01b8fea11287153fa37fb471fda6a62 (diff)
downloadpaludis-91684c275c862aebc7272b7907a092a525b6f7c9.tar.gz
paludis-91684c275c862aebc7272b7907a092a525b6f7c9.tar.xz
Work around weird bug somewhere deep in the Ruby internals
-rw-r--r--ruby/repository.cc10
-rw-r--r--ruby/repository_TEST.rb27
2 files changed, 17 insertions, 20 deletions
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 83f5a13..faf5fe9 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2006, 2007, 2008 Richard Brown
* Copyright (c) 2007 David Leverton
*
@@ -896,10 +896,10 @@ namespace
tr1::shared_ptr<Repository> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
if ((*self_ptr)->environment_variable_interface)
- return rb_str_new2((*self_ptr)->environment_variable_interface->get_environment_variable(value_to_package_id(pid),StringValuePtr(ev)).c_str());
-
+ return rb_str_new2((*self_ptr)->environment_variable_interface->get_environment_variable(
+ value_to_package_id(pid),
+ StringValuePtr(ev)).c_str());
return Qnil;
-
}
void do_register_repository()
@@ -966,7 +966,7 @@ namespace
RUBY_FUNC_CAST((&RepositoryKey<MetadataStringKey, &Repository::format_key>::fetch)), 0);
rb_define_method(c_repository, "installed_root_key",
RUBY_FUNC_CAST((&RepositoryKey<MetadataFSEntryKey, &Repository::installed_root_key>::fetch)), 0);
- rb_define_method(c_repository, "get_environment_variable", RUBY_FUNC_CAST(&repository_get_environment_variable),2);
+ rb_define_method(c_repository, "get_environment_variable", RUBY_FUNC_CAST(&repository_get_environment_variable), 2);
/*
* Document-class: Paludis::ProfilesDescLine
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 04060bd..94e7662 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2006, 2007 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
# Copyright (c) 2006, 2007, 2008 Richard Brown
#
# This file is part of the Paludis package manager. Paludis is free software;
@@ -182,6 +182,16 @@ module Paludis
assert_equal installed_repo.name, installed_repo.provides_interface.name
assert_nil installed_repo.syncable_interface
end
+
+ def text_repository_environment_interface
+ assert_not_nil repo.environment_variable_interface
+ end
+
+ def test_get_environment_variable
+ pid = db.query(Query::Matches.new(Paludis::parse_user_package_dep_spec('=foo/bar-1.0', [])), QueryOrder::BestVersionOnly).first;
+ assert_equal "hello", repo.get_environment_variable(pid, "TEST_ENV_VAR")
+ assert_equal "", repo.get_environment_variable(pid, "TEST_UNSET_ENV_VAR")
+ end
end
class TestCase_RepositoryCheckQA < Test::Unit::TestCase
@@ -586,6 +596,7 @@ module Paludis
assert_raise BadVersionSpecError do f.add_version('foo', 'bar', 'abc') end
end
end
+
class TestCase_Repository < Test::Unit::TestCase
include RepositoryTestCase
@@ -613,19 +624,5 @@ module Paludis
assert_nil repo['monkey']
end
end
-
- class TestCase_RepositoryEnvironmentVariables < Test::Unit::TestCase
- include RepositoryTestCase
-
- def text_repository_environment_interface
- assert_not_nil repo.environment_variable_interface
- end
-
- def test_get_environment_variable
- pid = db.query(Query::Matches.new(Paludis::parse_user_package_dep_spec('=foo/bar-1.0', [])), QueryOrder::BestVersionOnly).first;
- assert_equal "hello", repo.get_environment_variable(pid, "TEST_ENV_VAR")
- assert_equal "", repo.get_environment_variable(pid, "TEST_UNSET_ENV_VAR")
- end
- end
end