| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| 1 | import subprocess |
||
| 13 | class IndentBearTest(LocalBearTestHelper): |
||
| 14 | def setUp(self): |
||
| 15 | self.section = Section('name') |
||
| 16 | self.section.append(Setting("use_spaces", "true")) |
||
| 17 | self.section.append(Setting("max_line_length", "80")) |
||
| 18 | self.uut = IndentBear(self.section, Queue()) |
||
| 19 | |||
| 20 | def test_valid(self): |
||
| 21 | self.assertLinesValid(self.uut, ["int\n", |
||
| 22 | "main ()\n", |
||
| 23 | "{\n", |
||
| 24 | " return 0;\n", |
||
| 25 | "}\n"]) |
||
| 26 | |||
| 27 | def test_tab_width(self): |
||
| 28 | self.section.append(Setting("tab_width", "2")) |
||
| 29 | self.assertLinesValid(self.uut, ["int\n", |
||
| 30 | "main ()\n", |
||
| 31 | "{\n", |
||
| 32 | " return 0;\n", |
||
| 33 | "}\n"]) |
||
| 34 | |||
| 35 | def test_tabs(self): |
||
| 36 | self.section.append(Setting("use_spaces", "nope")) |
||
| 37 | self.assertLinesValid(self.uut, ["int\n", |
||
| 38 | "main ()\n", |
||
| 39 | "{\n", |
||
| 40 | "\treturn 0;\n", |
||
| 41 | "}\n"]) |
||
| 42 | |||
| 43 | def test_invalid(self): |
||
| 44 | self.assertLinesInvalid(self.uut, ["int main() {\n", |
||
| 45 | " return 0;\n", |
||
| 46 | "}\n"]) |
||
| 47 | |||
| 61 |