diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-12 11:00:54 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-12 11:00:54 -0600 |
| commit | dd7caa76e160ed51c8b0e123c18f7526b575bfec (patch) | |
| tree | b1014b34503396cfa7efd56d5ec78860a8d29b51 /test | |
| parent | 47a26054fea97641aebb3906ca7416a982f4c0d5 (diff) | |
| download | puppet-dd7caa76e160ed51c8b0e123c18f7526b575bfec.tar.gz puppet-dd7caa76e160ed51c8b0e123c18f7526b575bfec.tar.xz puppet-dd7caa76e160ed51c8b0e123c18f7526b575bfec.zip | |
Moving some compile tests to the spec/ directory, and
switching the node scope to no longer be lazy evaluation,
just like I switched 'main'. When I made all of these
classes and nodes lazy evaluated, I should have decoupled
my real goal (using resources to evaluate them) from the idea
of lazy-evaluating them, and this basically does that.
I also changed the scope heirarchy slightly so that scopes will
tend to be below the node scope, altho this was already generally
the case.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/language/compile.rb | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/test/language/compile.rb b/test/language/compile.rb index f5d9cb7d9..50b16a24d 100755 --- a/test/language/compile.rb +++ b/test/language/compile.rb @@ -188,79 +188,6 @@ class TestCompile < Test::Unit::TestCase end end - # Make sure we either don't look for nodes, or that we find and evaluate the right object. - def test_evaluate_ast_node - # First try it with ast_nodes disabled - compile = mkcompile - name = compile.node.name - compile.expects(:ast_nodes?).returns(false) - compile.parser.expects(:nodes).never - - assert_nothing_raised("Could not call evaluate_ast_node when ast nodes are disabled") do - compile.send(:evaluate_ast_node) - end - - assert_nil(compile.resources.find { |r| r.to_s == "Node[#{name}]" }, "Created node object when ast_nodes was false") - - # Now try it with them enabled, but no node found. - nodes = mock 'node_hash' - compile = mkcompile - name = compile.node.name - compile.expects(:ast_nodes?).returns(true) - compile.parser.stubs(:nodes).returns(nodes) - - # Set some names for our test - @node.names = %w{a b c} - nodes.expects(:[]).with("a").returns(nil) - nodes.expects(:[]).with("b").returns(nil) - nodes.expects(:[]).with("c").returns(nil) - - # It should check this last, of course. - nodes.expects(:[]).with("default").returns(nil) - - # And make sure the lack of a node throws an exception - assert_raise(Puppet::ParseError, "Did not fail when we couldn't find an ast node") do - compile.send(:evaluate_ast_node) - end - - # Finally, make sure it works dandily when we have a node - compile = mkcompile - compile.expects(:ast_nodes?).returns(true) - - node = stub 'node', :classname => "c" - nodes = {"c" => node} - compile.parser.stubs(:nodes).returns(nodes) - - # Set some names for our test - @node.names = %w{a b c} - - # And make sure we throw no exceptions. - assert_nothing_raised("Failed when a node was found") do - compile.send(:evaluate_ast_node) - end - - assert_instance_of(Puppet::Parser::Resource, compile.resources.find { |r| r.to_s == "Node[c]" }, - "Did not create node resource") - - # Lastly, check when we actually find the default. - compile = mkcompile - compile.expects(:ast_nodes?).returns(true) - - node = stub 'node', :classname => "default" - nodes = {"default" => node} - compile.parser.stubs(:nodes).returns(nodes) - - # Set some names for our test - @node.names = %w{a b c} - - # And make sure the lack of a node throws an exception - assert_nothing_raised("Failed when a node was found") do - compile.send(:evaluate_ast_node) - end - assert_instance_of(Puppet::Parser::Resource, compile.resources.find { |r| r.to_s == "Node[default]" }, - "Did not create default node resource") - end - def test_evaluate_node_classes compile = mkcompile @node.classes = %w{one two three four} |
