63
63
script._script_to_commands('$ cd trunk'))
65
65
def test_command_with_single_quoted_param(self):
66
story = """$ bzr commit -m 'two words'"""
67
self.assertEqual([(['bzr', 'commit', '-m', "'two words'"],
66
story = """$ brz commit -m 'two words'"""
67
self.assertEqual([(['brz', 'commit', '-m', "'two words'"],
68
68
None, None, None)],
69
69
script._script_to_commands(story))
71
71
def test_command_with_double_quoted_param(self):
72
story = """$ bzr commit -m "two words" """
73
self.assertEqual([(['bzr', 'commit', '-m', '"two words"'],
72
story = """$ brz commit -m "two words" """
73
self.assertEqual([(['brz', 'commit', '-m', '"two words"'],
74
74
None, None, None)],
75
75
script._script_to_commands(story))
83
83
# scripts are commonly given indented within the test source code, and
84
84
# common indentation is stripped off
90
self.assertEqual([(['bzr', 'add'], None,
90
self.assertEqual([(['brz', 'add'], None,
91
91
'adding file\nadding file2\n', None)],
92
92
script._script_to_commands(story))
94
94
def test_command_with_output(self):
100
self.assertEqual([(['bzr', 'add'], None,
100
self.assertEqual([(['brz', 'add'], None,
101
101
'adding file\nadding file2\n', None)],
102
102
script._script_to_commands(story))
104
104
def test_command_with_error(self):
107
2>bzr: ERROR: Not a branch: "foo"
107
2>brz: ERROR: Not a branch: "foo"
109
self.assertEqual([(['bzr', 'branch', 'foo'],
110
None, None, 'bzr: ERROR: Not a branch: "foo"\n')],
109
self.assertEqual([(['brz', 'branch', 'foo'],
110
None, None, 'brz: ERROR: Not a branch: "foo"\n')],
111
111
script._script_to_commands(story))
113
113
def test_input_without_command(self):
119
119
def test_command_with_backquotes(self):
121
$ foo = `bzr file-id toto`
121
$ foo = `brz file-id toto`
123
self.assertEqual([(['foo', '=', '`bzr file-id toto`'],
123
self.assertEqual([(['foo', '=', '`brz file-id toto`'],
124
124
None, None, None)],
125
125
script._script_to_commands(story))
233
233
def test_continue_on_error_output(self):
234
234
# The status matters, not the output
242
$ bzr commit -m 'adding file'
242
$ brz commit -m 'adding file'
245
245
self.run_script(story)
409
409
self.assertEqual(self.test_dir, osutils.getcwd())
412
class TestBzr(script.TestCaseWithTransportAndScript):
412
class TestBrz(script.TestCaseWithTransportAndScript):
414
def test_bzr_smoke(self):
414
def test_brz_smoke(self):
415
415
self.run_script("""
417
417
Created a standalone tree (format: ...)
419
419
self.assertPathExists('branch')
579
579
commands.builtin_command_registry.register(cmd_test_confirm)
580
580
self.addCleanup(commands.builtin_command_registry.remove, 'test-confirm')
581
581
self.run_script("""
583
583
2>Really do it? ([y]es, [n]o): yes
587
587
2>Really do it? ([y]es, [n]o): no
595
595
super(TestShelve, self).setUp()
596
596
self.run_script("""
598
598
Created a standalone tree (format: 2a)
600
600
$ echo foo > file
603
$ bzr commit -m 'file added'
603
$ brz commit -m 'file added'
604
604
2>Committing to:...test/
606
606
2>Committed revision 1.
610
610
def test_shelve(self):
611
611
self.run_script("""
612
$ bzr shelve -m 'shelve bar'
612
$ brz shelve -m 'shelve bar'
613
613
2>Shelve? ([y]es, [N]o, [f]inish, [q]uit): yes
615
615
2>Selected changes:
621
621
null_output_matches_anything=True)
622
622
self.run_script("""
627
627
def test_dont_shelve(self):
628
628
# We intentionally provide no input here to test EOF
629
629
self.run_script("""
630
$ bzr shelve -m 'shelve bar'
630
$ brz shelve -m 'shelve bar'
631
631
2>Shelve? ([y]es, [N]o, [f]inish, [q]uit):
632
632
2>No changes to shelve.
634
634
null_output_matches_anything=True)
635
635
self.run_script("""