~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

Merge updates in shell-like tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
                          script._script_to_commands(story))
84
84
 
85
85
 
86
 
class TestScriptExecution(script.TestCaseWithScript):
 
86
class TestScriptExecution(script.TestCaseWithTransportAndScript):
87
87
 
88
88
    def test_unknown_command(self):
89
89
        self.assertRaises(SyntaxError, self.run_script, 'foo')
90
90
 
91
 
    def test_unexpected_output(self):
 
91
    def test_stops_on_unexpected_output(self):
92
92
        story = """
93
93
mkdir dir
94
94
cd dir
97
97
        self.assertRaises(AssertionError, self.run_script, story)
98
98
 
99
99
 
100
 
class TestCat(script.TestCaseWithScript):
 
100
    def test_stops_on_unexpected_error(self):
 
101
        story = """
 
102
cat
 
103
<Hello
 
104
bzr not-a-command
 
105
"""
 
106
        self.assertRaises(AssertionError, self.run_script, story)
 
107
 
 
108
    def test_continue_on_expected_error(self):
 
109
        story = """
 
110
bzr not-a-command
 
111
2>..."not-a-command"
 
112
"""
 
113
        self.run_script(story)
 
114
 
 
115
    def test_ellipsis_output(self):
 
116
        story = """
 
117
cat
 
118
<first line
 
119
<second line
 
120
<last line
 
121
>first line
 
122
>...
 
123
>last line
 
124
"""
 
125
        self.run_script(story)
 
126
        story = """
 
127
bzr not-a-command
 
128
2>..."not-a-command"
 
129
"""
 
130
        self.run_script(story)
 
131
 
 
132
        story = """
 
133
bzr branch not-a-branch
 
134
2>bzr: ERROR: Not a branch...not-a-branch/".
 
135
"""
 
136
        self.run_script(story)
 
137
 
 
138
 
 
139
class TestCat(script.TestCaseWithTransportAndScript):
101
140
 
102
141
    def test_cat_usage(self):
103
142
        self.assertRaises(SyntaxError, self.run_script, 'cat foo bar baz')
130
169
        self.assertFileEqual('content\n', 'file2')
131
170
 
132
171
 
133
 
class TestMkdir(script.TestCaseWithScript):
 
172
class TestMkdir(script.TestCaseWithTransportAndScript):
134
173
 
135
174
    def test_mkdir_usage(self):
136
175
        self.assertRaises(SyntaxError, self.run_script, 'mkdir')
151
190
        self.failUnlessExists('dir2')
152
191
 
153
192
 
154
 
class TestCd(script.TestCaseWithScript):
 
193
class TestCd(script.TestCaseWithTransportAndScript):
155
194
 
156
195
    def test_cd_usage(self):
157
196
        self.assertRaises(SyntaxError, self.run_script, 'cd foo bar')
173
212
        self.assertEquals(self.test_dir, osutils.getcwd())
174
213
 
175
214
 
176
 
class TestBzr(script.TestCaseWithScript):
 
215
class TestBzr(script.TestCaseWithTransportAndScript):
177
216
 
178
217
    def test_bzr_smoke(self):
179
218
        self.run_script('bzr init branch')
180
219
        self.failUnlessExists('branch')
181
220
 
182
221
 
183
 
class TestEcho(script.TestCaseWithScript):
 
222
class TestEcho(script.TestCaseWithMemoryTransportAndScript):
184
223
 
185
224
    def test_echo_usage(self):
186
225
        story = """