/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: Martin Pool
  • Date: 2010-09-13 08:14:44 UTC
  • mto: (5416.1.8 ui-factory)
  • mto: This revision was merged to the branch mainline in revision 5422.
  • Revision ID: mbp@sourcefrog.net-20100913081444-63v2l3wqb9e45ab3
Better handling of blank lines in test scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    def test_comment_is_ignored(self):
30
30
        self.assertEquals([], script._script_to_commands('#comment\n'))
31
31
 
32
 
    def test_empty_line_is_ignored(self):
33
 
        self.assertEquals([], script._script_to_commands('\n'))
 
32
    def test_trim_blank_lines(self):
 
33
        """Blank lines are respected, but trimmed at the start and end.
 
34
 
 
35
        Python triple-quoted syntax is going to give stubby/empty blank lines 
 
36
        right at the start and the end.  These are cut off so that callers don't 
 
37
        need special syntax to avoid them.
 
38
 
 
39
        However we do want to be able to match commands that emit blank lines.
 
40
        """
 
41
        self.assertEquals([
 
42
            (['bar'], None, '\n', None),
 
43
            ],
 
44
            script._script_to_commands("""
 
45
            $bar
 
46
 
 
47
            """))
34
48
 
35
49
    def test_simple_command(self):
36
50
        self.assertEquals([(['cd', 'trunk'], None, None, None)],
379
393
        self.assertEquals(None, err)
380
394
        self.assertFileEqual('hello\nhappy\n', 'file')
381
395
 
 
396
    def test_empty_line_in_output_is_respected(self):
 
397
        self.run_script("""
 
398
            $ echo
 
399
 
 
400
            $ echo bar
 
401
            bar
 
402
            """)
 
403
 
382
404
 
383
405
class TestRm(script.TestCaseWithTransportAndScript):
384
406