~nvalcarcel/ubuntu/lucid/puppet/fix-546677

« back to all changes in this revision

Viewing changes to test/util/fileparsing.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:
8
8
require 'puppet/util/fileparsing'
9
9
 
10
10
class TestUtilFileParsing < Test::Unit::TestCase
11
 
        include PuppetTest
12
 
        include PuppetTest::FileParsing
 
11
    include PuppetTest
 
12
    include PuppetTest::FileParsing
13
13
 
14
14
    class FParser
15
15
        include Puppet::Util::FileParsing
72
72
 
73
73
        # Make sure it matches
74
74
        assert_nothing_raised do
75
 
            assert_equal({:record_type => :comment, :line => comment}, 
 
75
            assert_equal({:record_type => :comment, :line => comment},
76
76
                 @parser.parse_line(comment))
77
77
        end
78
78
 
88
88
 
89
89
        # The comment should still match
90
90
        assert_nothing_raised do
91
 
            assert_equal({:record_type => :comment, :line => comment}, 
 
91
            assert_equal({:record_type => :comment, :line => comment},
92
92
                 @parser.parse_line(comment))
93
93
        end
94
94
 
95
95
        # As should our new line type
96
96
        assert_nothing_raised do
97
 
            assert_equal({:record_type => :blank, :line => ""}, 
 
97
            assert_equal({:record_type => :blank, :line => ""},
98
98
                 @parser.parse_line(""))
99
99
        end
100
100
 
141
141
        end
142
142
 
143
143
        assert_nothing_raised("Did not parse old comment") do
144
 
            assert_equal({:record_type => :comment, :line => comment}, 
 
144
            assert_equal({:record_type => :comment, :line => comment},
145
145
                 @parser.parse_line(comment))
146
146
        end
147
147
        comment = '" another type of comment'
148
148
        assert_nothing_raised("Did not parse new comment") do
149
 
            assert_equal({:record_type => :comment2, :line => comment}, 
 
149
            assert_equal({:record_type => :comment2, :line => comment},
150
150
                 @parser.parse_line(comment))
151
151
        end
152
152
 
318
318
            # Check parsing first
319
319
            result = @parser.parse_line(start)
320
320
            [:one, :two].each do |param|
321
 
                assert_equal(record[param], result[param], 
 
321
                assert_equal(record[param], result[param],
322
322
                    "Did not correctly parse %s" % start.inspect)
323
323
            end
324
324
 
598
598
end
599
599
 
600
600
class TestUtilFileRecord < Test::Unit::TestCase
601
 
        include PuppetTest
602
 
        include PuppetTest::FileParsing
 
601
    include PuppetTest
 
602
    include PuppetTest::FileParsing
603
603
 
604
604
    Record = Puppet::Util::FileParsing::FileRecord
605
605
    def test_new_filerecord