~ubuntu-branches/ubuntu/lucid/puppet/lucid-security

« back to all changes in this revision

Viewing changes to test/language/ast/selector.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-12-23 00:48:10 UTC
  • mfrom: (1.1.10 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091223004810-3i4oryds922g5n59
Tags: 0.25.1-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/rules:
    + Don't start puppet when first installing puppet.
  - debian/puppet.conf, lib/puppet/defaults.rb:
    + Move templates to /etc/puppet
  - lib/puppet/defaults.rb:
    + Fix /var/lib/puppet/state ownership.
  - man/man8/puppet.conf.8: 
    + Fix broken URL in manpage.
  - debian/control:
    + Update maintainer accordint to spec.
    + Puppetmaster Recommends -> Suggests
    + Created puppet-testsuite as a seperate. Allow the users to run puppet's 
      testsuite.
  - tests/Rakefile: Fix rakefile so that the testsuite can acutally be ran.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
require 'puppettest/parsertesting'
10
10
 
11
11
class TestSelector < Test::Unit::TestCase
12
 
        include PuppetTest
13
 
        include PuppetTest::ParserTesting
14
 
        AST = Puppet::Parser::AST
15
 
    
 
12
    include PuppetTest
 
13
    include PuppetTest::ParserTesting
 
14
    AST = Puppet::Parser::AST
 
15
 
16
16
    def test_evaluate
17
17
        scope = mkscope
18
18
        upperparam = nameobj("MYPARAM")
19
19
        lowerparam = nameobj("myparam")
20
 
        
 
20
 
21
21
        should = {"MYPARAM" => "upper", "myparam" => "lower"}
22
 
        
 
22
 
23
23
        maker = Proc.new do
24
24
            {
25
25
            :default => AST::ResourceParam.new(:param => AST::Default.new(:value => "default"), :value => FakeAST.new("default")),
26
26
            :lower => AST::ResourceParam.new(:param => FakeAST.new("myparam"), :value => FakeAST.new("lower")),
27
27
            :upper => AST::ResourceParam.new(:param => FakeAST.new("MYPARAM"), :value => FakeAST.new("upper")),
28
28
            }
29
 
            
 
29
 
30
30
        end
31
 
        
 
31
 
32
32
        # Start out case-sensitive
33
33
        Puppet[:casesensitive] = true
34
 
        
 
34
 
35
35
        %w{MYPARAM myparam}.each do |str|
36
36
            param = nameobj(str)
37
37
            params = maker.call()
40
40
            assert_nothing_raised { result = sel.evaluate(scope) }
41
41
            assert_equal(should[str], result, "did not case-sensitively match %s" % str)
42
42
        end
43
 
        
 
43
 
44
44
        # then insensitive
45
45
        Puppet[:casesensitive] = false
46
 
        
 
46
 
47
47
        %w{MYPARAM myparam}.each do |str|
48
48
            param = nameobj(str)
49
49
            params = maker.call()