~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_utextwrap.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 04:01:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5874.
  • Revision ID: songofacandy@gmail.com-20110505040118-41e98324pd3kkteu
Add some test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.check_cut(s, 12, 8)
58
58
        self.check_cut(s, 13, 9)
59
59
        self.check_cut(s, 14, 9)
 
60
        self.check_cut('A'*5, 3, 3)
60
61
 
61
62
    def test_split(self):
62
63
        w = utextwrap.UTextWrapper()
103
104
                    _str_D[2:]
104
105
                    ]))
105
106
 
 
107
    def test_fill_indent(self):
 
108
        w = utextwrap.UTextWrapper(8,
 
109
                initial_indent=' '*4, subsequent_indent=' '*4)
 
110
 
 
111
        self.assertEqual(w.fill(_str_SD),
 
112
                u'\n'.join([
 
113
                    "    hell",
 
114
                    "    o" + _str_D[0],
 
115
                    "    " + _str_D[1:3],
 
116
                    "    " + _str_D[3]
 
117
                    ]))
 
118
 
 
119
        w.break_long_words = False
 
120
 
 
121
        self.assertEqual(w.fill(_str_SD),
 
122
                u'\n'.join([
 
123
                    "    hello",
 
124
                    "    " + _str_D[:2],
 
125
                    "    " + _str_D[2:],
 
126
                    ]))
 
127
 
 
128
        w.width = 3
 
129
 
 
130
        self.assertEqual(w.fill(_str_SD),
 
131
                u'\n'.join([
 
132
                    "    hello",
 
133
                    "    " + _str_D[0],
 
134
                    "    " + _str_D[1],
 
135
                    "    " + _str_D[2],
 
136
                    "    " + _str_D[3],
 
137
                    ]))
 
138
 
106
139
 
107
140
# Regression test with Python's test_textwrap
108
141
# Note that some distribution including Ubuntu doesn't install