예제 #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
    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
    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
    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
 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
 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
    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
 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
 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
 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
 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
 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'))