~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/teststatus.py

Merge in format-5 work - release bzr 0.1rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
class BranchStatus(TestCaseInTempDir):
28
28
    
29
29
    def test_branch_status(self): 
30
 
        """Basic 'bzr mkdir' operation"""
 
30
        """Test basic branch status"""
31
31
        from cStringIO import StringIO
32
32
        from bzrlib.status import show_status
33
33
        from bzrlib.branch import Branch
93
93
                           '  bye.c\n',
94
94
                           '  hello.c\n'])
95
95
 
 
96
    def test_branch_status_specific_files(self): 
 
97
        """Tests branch status with given specific files"""
 
98
        from cStringIO import StringIO
 
99
        from bzrlib.status import show_status
 
100
        from bzrlib.branch import Branch
 
101
        
 
102
        b = Branch.initialize('.')
 
103
 
 
104
        self.build_tree(['directory/','directory/hello.c', 'bye.c','test.c','dir2/'])
 
105
        b.add('directory')
 
106
        b.add('test.c')
 
107
        b.commit('testing')
 
108
        
 
109
        tof = StringIO()
 
110
        show_status(b, to_file=tof)
 
111
        tof.seek(0)
 
112
        self.assertEquals(tof.readlines(),
 
113
                          ['unknown:\n',
 
114
                           '  bye.c\n',
 
115
                           '  dir2\n',
 
116
                           '  directory/hello.c\n'
 
117
                           ])
 
118
 
 
119
        tof = StringIO()
 
120
        show_status(b, specific_files=['bye.c','test.c','absent.c'], to_file=tof)
 
121
        tof.seek(0)
 
122
        self.assertEquals(tof.readlines(),
 
123
                          ['unknown:\n',
 
124
                           '  bye.c\n'
 
125
                           ])
 
126
        
 
127
        tof = StringIO()
 
128
        show_status(b, specific_files=['directory'], to_file=tof)
 
129
        tof.seek(0)
 
130
        self.assertEquals(tof.readlines(),
 
131
                          ['unknown:\n',
 
132
                           '  directory/hello.c\n'
 
133
                           ])
 
134
        tof = StringIO()
 
135
        show_status(b, specific_files=['dir2'], to_file=tof)
 
136
        tof.seek(0)
 
137
        self.assertEquals(tof.readlines(),
 
138
                          ['unknown:\n',
 
139
                           '  dir2\n'
 
140
                           ])