diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-07-05 16:32:03 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-07-15 11:52:41 -0700 |
| commit | bdc0f8716ae8ccb2b2657dfab591afe9589d8902 (patch) | |
| tree | 6f6b25251f0a581c878b833a90e5b3bab0ac5d11 /test | |
| parent | 9662045bfe551821823b38fe6511e621998aef0b (diff) | |
| download | puppet-bdc0f8716ae8ccb2b2657dfab591afe9589d8902.tar.gz puppet-bdc0f8716ae8ccb2b2657dfab591afe9589d8902.tar.xz puppet-bdc0f8716ae8ccb2b2657dfab591afe9589d8902.zip | |
Scope[] now returns nil for undefined variables
Given that we have the 'include?' method, this feature
is unnecessary, and it makes sense to convert to more
ruby-like behavior.
Any code that previously checked whether lookupvar
(or the new []) returned :undefined should now check
whether 'scope.include?(var)'. Thus, you can have
the same behavior, but it takes a bit different code
to get it.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Reviewed-by: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/scope.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/language/scope.rb b/test/language/scope.rb index 57824d887..c80178e7b 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -47,7 +47,7 @@ class TestScope < Test::Unit::TestCase # Now set a var in the midscope and make sure the mid and bottom can see it but not the top midscope['second'] = "midval" - assert_equal(:undefined, scopes[:top]['second'], "Found child var in top scope") + assert_nil(scopes[:top]['second'], "Found child var in top scope") [:mid, :bot].each do |name| assert_equal("midval", scopes[name]['second'], "Could not find var in #{name}") end @@ -55,7 +55,7 @@ class TestScope < Test::Unit::TestCase # And set something in the bottom, and make sure we only find it there. botscope['third'] = "botval" [:top, :mid].each do |name| - assert_equal(:undefined, scopes[name]['third'], "Found child var in top scope") + assert_nil(scopes[name]['third'], "Found child var in top scope") end assert_equal("botval", scopes[:bot]['third'], "Could not find var in bottom scope") |
