| Index: recipe_engine/unittests/util_test.py
|
| diff --git a/recipe_engine/unittests/util_test.py b/recipe_engine/unittests/util_test.py
|
| index 37932d65fbf4bb7f4ed19bd87f356b970b7184a7..f4fa6dc762ac76e237eb2842841dec0fc160f699 100755
|
| --- a/recipe_engine/unittests/util_test.py
|
| +++ b/recipe_engine/unittests/util_test.py
|
| @@ -87,5 +87,47 @@ class TestMapDeferExceptions(unittest.TestCase):
|
| self.assertRaises(ValueError, util.map_defer_exceptions, fn, [1], KeyError)
|
|
|
|
|
| +class TestSnipOutputLines(unittest.TestCase):
|
| +
|
| + def testIdempotentOnSmallData(self):
|
| + small_data = [
|
| + [''],
|
| + ['', ''],
|
| + [' '],
|
| + [' ', ' '],
|
| + ['hello world'],
|
| + ['hello world', ''],
|
| + ['hello', 'world'],
|
| + ['', 'hello world'],
|
| + ]
|
| +
|
| + for d in small_data:
|
| + self.assertEqual(d, util.snip_output_lines(d, max_bytes=100))
|
| +
|
| + def testSnipWithNoLines(self):
|
| + lines = ['---------']
|
| + expected = ['--- ...', '<snip>', '... ---']
|
| + self.assertEqual(
|
| + expected, util.snip_output_lines(lines, max_bytes=6))
|
| +
|
| + def testSnipWithLines(self):
|
| + lines = ['-', '--', '--', '---', '-', '--']
|
| + expected = ['-', '--', '<snip>', '-' '--']
|
| + self.assertEqual(
|
| + expected, util.snip_output_lines(lines, max_bytes=6))
|
| +
|
| + def testSnipWithLines(self):
|
| + lines = ['----', '----', '----']
|
| + expected = ['--- ...', '<snip>', '... ---']
|
| + self.assertEqual(
|
| + expected, util.snip_output_lines(lines, max_bytes=6))
|
| +
|
| + def testExactlyEqual(self):
|
| + lines = ['---', '---']
|
| + expected = ['---', '---']
|
| + self.assertEqual(
|
| + expected, util.snip_output_lines(lines, max_bytes=6))
|
| +
|
| +
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|