From 8971d8beae2c409f9052f27c3f80ad3bdfff4de2 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 1 Dec 2009 16:41:38 -0800 Subject: Fixing #2596 - Node, Class, Definition are not AST This commit extracts these three classes into a single ResourceType class in the Parser heirarchy, now completely independent of the AST heirarchy. Most of the other changes are just changing the interface to the new class, which is greatly simplified over the previous classes. This opens up the possibility of drastically simplifying a lot of this other code, too -- in particular, replacing the reference to the parser with a reference to the (soon to be renamed) LoadedCode class. Signed-off-by: Luke Kanies --- spec/integration/parser/parser.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 spec/integration/parser/parser.rb (limited to 'spec/integration/parser/parser.rb') diff --git a/spec/integration/parser/parser.rb b/spec/integration/parser/parser.rb new file mode 100755 index 000000000..71ae136ed --- /dev/null +++ b/spec/integration/parser/parser.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Parser::Parser do + before :each do + @loaded_code = Puppet::Parser::LoadedCode.new + @parser = Puppet::Parser::Parser.new :environment => "development", :loaded_code => @loaded_code + end + + describe "when parsing comments before statement" do + it "should associate the documentation to the statement AST node" do + ast = @parser.parse(""" + # comment + class test {} + """) + + ast.hostclass("test").doc.should == "comment\n" + end + end +end -- cgit