コード例 #1
0
    def test_command_with_backquotes(self):
        story = """
$ foo = `bzr file-id toto`
"""
        self.assertEqual([(['foo', '=', '`bzr file-id toto`'],
                            None, None, None)],
                          script._script_to_commands(story))
コード例 #2
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
    def test_command_with_backquotes(self):
        story = """
$ foo = `bzr file-id toto`
"""
        self.assertEquals([(['foo', '=', '`bzr file-id toto`'],
                            None, None, None)],
                          script._script_to_commands(story))
コード例 #3
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
    def test_command_with_error(self):
        story = """
$ bzr branch foo
2>bzr: ERROR: Not a branch: "foo"
"""
        self.assertEquals([(['bzr', 'branch', 'foo'],
                            None, None, 'bzr: ERROR: Not a branch: "foo"\n')],
                          script._script_to_commands(story))
コード例 #4
0
    def test_command_with_error(self):
        story = """
$ bzr branch foo
2>bzr: ERROR: Not a branch: "foo"
"""
        self.assertEqual([(['bzr', 'branch', 'foo'],
                            None, None, 'bzr: ERROR: Not a branch: "foo"\n')],
                          script._script_to_commands(story))
コード例 #5
0
    def test_command_with_output(self):
        story = """
$ bzr add
adding file
adding file2
"""
        self.assertEqual([(['bzr', 'add'], None,
                            'adding file\nadding file2\n', None)],
                          script._script_to_commands(story))
コード例 #6
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
    def test_command_with_output(self):
        story = """
$ bzr add
adding file
adding file2
"""
        self.assertEquals([(['bzr', 'add'], None,
                            'adding file\nadding file2\n', None)],
                          script._script_to_commands(story))
コード例 #7
0
 def test_comment_multiple_lines(self):
     self.assertEqual([
         (['bar'], None, None, None),
         ],
         script._script_to_commands("""
         # this comment is ignored
         # so is this
         # no we run bar
         $ bar
         """))
コード例 #8
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_comment_multiple_lines(self):
     self.assertEquals([
         (['bar'], None, None, None),
         ],
         script._script_to_commands("""
         # this comment is ignored
         # so is this
         # no we run bar
         $ bar
         """))
コード例 #9
0
 def test_indented(self):
     # scripts are commonly given indented within the test source code, and
     # common indentation is stripped off
     story = """
         $ bzr add
         adding file
         adding file2
         """
     self.assertEqual([(['bzr', 'add'], None,
                         'adding file\nadding file2\n', None)],
                       script._script_to_commands(story))
コード例 #10
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_indented(self):
     # scripts are commonly given indented within the test source code, and
     # common indentation is stripped off
     story = """
         $ bzr add
         adding file
         adding file2
         """
     self.assertEquals([(['bzr', 'add'], None,
                         'adding file\nadding file2\n', None)],
                       script._script_to_commands(story))
コード例 #11
0
    def test_trim_blank_lines(self):
        """Blank lines are respected, but trimmed at the start and end.

        Python triple-quoted syntax is going to give stubby/empty blank lines 
        right at the start and the end.  These are cut off so that callers don't 
        need special syntax to avoid them.

        However we do want to be able to match commands that emit blank lines.
        """
        self.assertEqual([
            (['bar'], None, '\n', None),
            ],
            script._script_to_commands("""
            $bar

            """))
コード例 #12
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
    def test_trim_blank_lines(self):
        """Blank lines are respected, but trimmed at the start and end.

        Python triple-quoted syntax is going to give stubby/empty blank lines 
        right at the start and the end.  These are cut off so that callers don't 
        need special syntax to avoid them.

        However we do want to be able to match commands that emit blank lines.
        """
        self.assertEquals([
            (['bar'], None, '\n', None),
            ],
            script._script_to_commands("""
            $bar

            """))
コード例 #13
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_comment_is_ignored(self):
     self.assertEquals([], script._script_to_commands('#comment\n'))
コード例 #14
0
 def test_command_with_single_quoted_param(self):
     story = """$ bzr commit -m 'two words'"""
     self.assertEqual([(['bzr', 'commit', '-m', "'two words'"],
                         None, None, None)],
                        script._script_to_commands(story))
コード例 #15
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_command_with_input(self):
     self.assertEquals(
         [(['cat', '>file'], 'content\n', None, None)],
         script._script_to_commands('$ cat >file\n<content\n'))
コード例 #16
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_command_with_double_quoted_param(self):
     story = """$ bzr commit -m "two words" """
     self.assertEquals([(['bzr', 'commit', '-m', '"two words"'],
                         None, None, None)],
                        script._script_to_commands(story))
コード例 #17
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_command_with_single_quoted_param(self):
     story = """$ bzr commit -m 'two words'"""
     self.assertEquals([(['bzr', 'commit', '-m', "'two words'"],
                         None, None, None)],
                        script._script_to_commands(story))
コード例 #18
0
ファイル: test_script.py プロジェクト: Distrotech/bzr
 def test_simple_command(self):
     self.assertEquals([(['cd', 'trunk'], None, None, None)],
                        script._script_to_commands('$ cd trunk'))
コード例 #19
0
 def test_command_with_double_quoted_param(self):
     story = """$ bzr commit -m "two words" """
     self.assertEqual([(['bzr', 'commit', '-m', '"two words"'],
                         None, None, None)],
                        script._script_to_commands(story))
コード例 #20
0
 def test_simple_command(self):
     self.assertEqual([(['cd', 'trunk'], None, None, None)],
                        script._script_to_commands('$ cd trunk'))
コード例 #21
0
 def test_comment_is_ignored(self):
     self.assertEqual([], script._script_to_commands('#comment\n'))
コード例 #22
0
 def test_command_with_input(self):
     self.assertEqual(
         [(['cat', '>file'], 'content\n', None, None)],
         script._script_to_commands('$ cat >file\n<content\n'))