diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-14 06:21:03 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-14 06:21:03 +0000 |
| commit | 12452ee9ca294563f2e2724ff36f179004f9846f (patch) | |
| tree | bee6053e8164f4a8dbf214f1898fafecb1d61f2f /test/puppet | |
| parent | 4d6120a1f77cfe76fafbe32caa5d853449562376 (diff) | |
| download | puppet-12452ee9ca294563f2e2724ff36f179004f9846f.tar.gz puppet-12452ee9ca294563f2e2724ff36f179004f9846f.tar.xz puppet-12452ee9ca294563f2e2724ff36f179004f9846f.zip | |
Merging r1468 from the implementations branch with r1438 from when the branch was first created.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1469 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/puppet')
| -rwxr-xr-x | test/puppet/utiltest.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/puppet/utiltest.rb b/test/puppet/utiltest.rb index ebf61e0f0..c2dcdada5 100755 --- a/test/puppet/utiltest.rb +++ b/test/puppet/utiltest.rb @@ -294,6 +294,48 @@ class TestPuppetUtil < Test::Unit::TestCase assert(Process.euid == 0, "UID did not get reset") end end + + def test_proxy + klass = Class.new do + attr_accessor :hash + class << self + attr_accessor :ohash + end + end + klass.send(:include, Puppet::Util) + + klass.ohash = {} + + inst = klass.new + inst.hash = {} + assert_nothing_raised do + Puppet::Util.proxy klass, :hash, "[]", "[]=", :clear, :delete + end + + assert_nothing_raised do + Puppet::Util.classproxy klass, :ohash, "[]", "[]=", :clear, :delete + end + + assert_nothing_raised do + inst[:yay] = "boo" + inst["cool"] = :yayness + end + + [:yay, "cool"].each do |var| + assert_equal(inst.hash[var], inst[var], + "Var %s did not take" % var) + end + + assert_nothing_raised do + klass[:Yay] = "boo" + klass["Cool"] = :yayness + end + + [:Yay, "Cool"].each do |var| + assert_equal(inst.hash[var], inst[var], + "Var %s did not take" % var) + end + end end # $Id$ |
