summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/resource
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-25 22:20:39 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-11-26 16:09:47 +1100
commit3421954444f4c06d6e7b80430f89fccf56343fe2 (patch)
treeed5d90a44a78ba25c242d5217bd795653fbec04c /spec/unit/parser/resource
parenta1ac9a5c14d4589f5ee7fdaab3b2c47180c66a2e (diff)
downloadpuppet-3421954444f4c06d6e7b80430f89fccf56343fe2.tar.gz
puppet-3421954444f4c06d6e7b80430f89fccf56343fe2.tar.xz
puppet-3421954444f4c06d6e7b80430f89fccf56343fe2.zip
Fixing #1755 - handling fully qualified classes correctly.
This involves lexing '::class' tokens along with correctly looking them up from the Resource::Reference class. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/parser/resource')
-rwxr-xr-xspec/unit/parser/resource/reference.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index 147f772d1..bb1452692 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -72,4 +72,24 @@ describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
ref.builtin?.should be_false
ref.definedtype.object_id.should == @nodedef.object_id
end
+
+ it "should only look for fully qualified classes" do
+ top = @parser.newclass "top"
+ sub = @parser.newclass "other::top"
+
+ scope = @compiler.topscope.class.new(:parent => @compiler.topscope, :namespace => "other", :parser => @parser)
+
+ ref = @type.new(:type => "class", :title => "top", :scope => scope)
+ ref.definedtype.classname.should equal(top.classname)
+ end
+
+ it "should only look for fully qualified definitions" do
+ top = @parser.newdefine "top"
+ sub = @parser.newdefine "other::top"
+
+ scope = @compiler.topscope.class.new(:parent => @compiler.topscope, :namespace => "other", :parser => @parser)
+
+ ref = @type.new(:type => "top", :title => "foo", :scope => scope)
+ ref.definedtype.classname.should equal(top.classname)
+ end
end