~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_script.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
572
572
    def test_confirm_action(self):
573
573
        """You can write tests that demonstrate user confirmation.
574
574
        
575
 
        Specifically, ScriptRunner does't care if the output line for the prompt
576
 
        isn't terminated by a newline from the program; it's implicitly terminated 
577
 
        by the input.
 
575
        Specifically, ScriptRunner does't care if the output line for the
 
576
        prompt isn't terminated by a newline from the program; it's implicitly
 
577
        terminated by the input.
578
578
        """
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("""
582
582
            $ bzr test-confirm
583
 
            2>Really do it? [y/n]: 
584
 
            <yes
 
583
            2>Really do it? ([y]es, [n]o): yes
 
584
            <y
585
585
            Do it!
586
586
            $ bzr test-confirm
587
 
            2>Really do it? [y/n]: 
588
 
            <no
 
587
            2>Really do it? ([y]es, [n]o): no
 
588
            <n
589
589
            ok, no
590
590
            """)
591
591
 
 
592
class TestShelve(script.TestCaseWithTransportAndScript):
 
593
 
 
594
    def setUp(self):
 
595
        super(TestShelve, self).setUp()
 
596
        self.run_script("""
 
597
            $ bzr init test
 
598
            Created a standalone tree (format: 2a)
 
599
            $ cd test
 
600
            $ echo foo > file
 
601
            $ bzr add
 
602
            adding file
 
603
            $ bzr commit -m 'file added'
 
604
            2>Committing to:...test/
 
605
            2>added file
 
606
            2>Committed revision 1.
 
607
            $ echo bar > file
 
608
            """)
 
609
 
 
610
    def test_shelve(self):
 
611
        self.run_script("""
 
612
            $ bzr shelve -m 'shelve bar'
 
613
            2>Shelve? ([y]es, [N]o, [f]inish, [q]uit): yes
 
614
            <y
 
615
            2>Selected changes:
 
616
            2> M  file
 
617
            2>Shelve 1 change(s)? ([y]es, [N]o, [f]inish, [q]uit): yes
 
618
            <y
 
619
            2>Changes shelved with id "1".
 
620
            """,
 
621
                        null_output_matches_anything=True)
 
622
        self.run_script("""
 
623
            $ bzr shelve --list
 
624
              1: shelve bar
 
625
            """)
 
626
 
 
627
    def test_dont_shelve(self):
 
628
        # We intentionally provide no input here to test EOF
 
629
        self.run_script("""
 
630
            $ bzr shelve -m 'shelve bar'
 
631
            2>Shelve? ([y]es, [N]o, [f]inish, [q]uit): 
 
632
            2>No changes to shelve.
 
633
            """,
 
634
                        null_output_matches_anything=True)
 
635
        self.run_script("""
 
636
            $ bzr st
 
637
            modified:
 
638
              file
 
639
            """)