Mike Frysinger | a7f08bc | 2019-08-27 19:16:33 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
| 2 | # -*- coding: utf-8 -*- |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 3 | # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
Gilad Arnold | abb352e | 2012-09-23 08:24:27 | [diff] [blame] | 6 | |
Don Garrett | fb15e32 | 2016-06-22 02:12:08 | [diff] [blame] | 7 | """Unittests for builder.py.""" |
| 8 | |
| 9 | from __future__ import print_function |
| 10 | |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 11 | import subprocess |
| 12 | import unittest |
| 13 | |
| 14 | import builder |
| 15 | |
Don Garrett | fb15e32 | 2016-06-22 02:12:08 | [diff] [blame] | 16 | # pylint: disable=protected-access |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 17 | |
| 18 | class BuilderTest(unittest.TestCase): |
Don Garrett | fb15e32 | 2016-06-22 02:12:08 | [diff] [blame] | 19 | """Tests for builder.""" |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 20 | def testOutputOf(self): |
| 21 | self.assertRaises(subprocess.CalledProcessError, |
| 22 | builder._OutputOf, ['/bin/false']) |
| 23 | |
| 24 | hello = 'hello, world' |
| 25 | self.assertEqual(hello + '\n', |
| 26 | builder._OutputOf(['/bin/echo', hello])) |
| 27 | |
| 28 | |
| 29 | if __name__ == '__main__': |
| 30 | unittest.main() |