| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import shutil |
| 8 import sys |
| 9 import tempfile |
| 10 import unittest |
| 11 |
| 12 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname( |
| 13 os.path.abspath(__file__))))) |
| 14 |
| 15 from recipe_engine import step_runner |
| 16 |
| 17 |
| 18 class TestLinebuf(unittest.TestCase): |
| 19 def test_add_partial(self): |
| 20 lb = step_runner._streamingLinebuf() |
| 21 lb.ingest("blarf") |
| 22 self.assertEqual([], list(lb)) |
| 23 |
| 24 def test_add_whole(self): |
| 25 lb = step_runner._streamingLinebuf() |
| 26 lb.ingest("blarf\n") |
| 27 self.assertEqual(["blarf"], list(lb)) |
| 28 |
| 29 def test_add_partial_whole(self): |
| 30 lb = step_runner._streamingLinebuf() |
| 31 lb.ingest("foof\nfleem\nblarf") |
| 32 self.assertEqual(["foof", "fleem"], list(lb)) |
| 33 |
| 34 def test_leftovers(self): |
| 35 lb = step_runner._streamingLinebuf() |
| 36 |
| 37 lb.ingest("nerds") |
| 38 self.assertEqual([], list(lb)) |
| 39 |
| 40 lb.ingest("doop\n") |
| 41 self.assertEqual(["nerdsdoop"], list(lb)) |
| 42 |
| 43 self.assertEqual([], list(lb)) |
| 44 |
| 45 |
| 46 if __name__ == '__main__': |
| 47 unittest.main() |
| OLD | NEW |