~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: Vincent Ladeuil
  • Date: 2010-10-13 08:01:36 UTC
  • mfrom: (5447.5.1 config-read)
  • mto: This revision was merged to the branch mainline in revision 5499.
  • Revision ID: v.ladeuil+lp@free.fr-20101013080136-7o5qbbwgxhgncsj8
Merge config-read into config-modify

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    commands,
20
20
    osutils,
21
21
    tests,
 
22
    trace,
22
23
    ui,
23
24
    )
24
25
from bzrlib.tests import script
162
163
    def test_unknown_command(self):
163
164
        self.assertRaises(SyntaxError, self.run_script, 'foo')
164
165
 
 
166
    def test_blank_output_mismatches_output(self):
 
167
        """If you give output, the output must actually be blank.
 
168
        
 
169
        See <https://bugs.launchpad.net/bzr/+bug/637830>: previously blank
 
170
        output was a wildcard.  Now you must say ... if you want that.
 
171
        """
 
172
        self.assertRaises(AssertionError,
 
173
            self.run_script,
 
174
            """
 
175
            $ echo foo
 
176
            """)
 
177
 
 
178
    def test_ellipsis_everything(self):
 
179
        """A simple ellipsis matches everything."""
 
180
        self.run_script("""
 
181
        $ echo foo
 
182
        ...
 
183
        """)
 
184
 
 
185
    def test_ellipsis_matches_empty(self):
 
186
        self.run_script("""
 
187
        $ cd .
 
188
        ...
 
189
        """)
 
190
 
165
191
    def test_stops_on_unexpected_output(self):
166
192
        story = """
167
193
$ mkdir dir
170
196
"""
171
197
        self.assertRaises(AssertionError, self.run_script, story)
172
198
 
173
 
 
174
199
    def test_stops_on_unexpected_error(self):
175
200
        story = """
176
201
$ cat
190
215
        # The status matters, not the output
191
216
        story = """
192
217
$ bzr init
 
218
...
193
219
$ cat >file
194
220
<Hello
195
221
$ bzr add file
 
222
...
196
223
$ bzr commit -m 'adding file'
 
224
2>...
197
225
"""
198
226
        self.run_script(story)
199
227
 
245
273
cat dog "chicken" 'dragon'
246
274
""")
247
275
 
 
276
    def test_verbosity_isolated(self):
 
277
        """Global verbosity is isolated from commands run in scripts.
 
278
        """
 
279
        # see also 656694; we should get rid of global verbosity
 
280
        self.run_script("""
 
281
        $ bzr init --quiet a
 
282
        """)
 
283
        self.assertEquals(trace.is_quiet(), False)
 
284
 
248
285
 
249
286
class TestCat(script.TestCaseWithTransportAndScript):
250
287
 
356
393
class TestBzr(script.TestCaseWithTransportAndScript):
357
394
 
358
395
    def test_bzr_smoke(self):
359
 
        self.run_script('$ bzr init branch')
 
396
        self.run_script("""
 
397
            $ bzr init branch
 
398
            Created a standalone tree (format: ...)
 
399
            """)
360
400
        self.failUnlessExists('branch')
361
401
 
362
402