Mike Frysinger | a7f08bc | 2019-08-27 19:16:33 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
2 | # -*- coding: utf-8 -*- | ||||
Mike Frysinger | 8b0fc37 | 2022-09-08 07:24:24 | [diff] [blame] | 3 | # Copyright 2010 The ChromiumOS Authors |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 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 | |||||
Jack Rosenthal | 8de609d | 2023-02-09 20:20:35 | [diff] [blame] | 16 | |
Don Garrett | fb15e32 | 2016-06-22 02:12:08 | [diff] [blame] | 17 | # pylint: disable=protected-access |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 18 | |
Jack Rosenthal | 8de609d | 2023-02-09 20:20:35 | [diff] [blame] | 19 | |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 20 | class BuilderTest(unittest.TestCase): |
Jack Rosenthal | 8de609d | 2023-02-09 20:20:35 | [diff] [blame] | 21 | """Tests for builder.""" |
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 22 | |
Jack Rosenthal | 8de609d | 2023-02-09 20:20:35 | [diff] [blame] | 23 | def testOutputOf(self): |
24 | self.assertRaises( | ||||
25 | subprocess.CalledProcessError, builder._OutputOf, ["/bin/false"] | ||||
26 | ) | ||||
27 | |||||
28 | hello = "hello, world" | ||||
29 | self.assertEqual(hello + "\n", builder._OutputOf(["/bin/echo", hello])) | ||||
David Rochberg | 7c79a81 | 2011-01-19 19:24:45 | [diff] [blame] | 30 | |
31 | |||||
Jack Rosenthal | 8de609d | 2023-02-09 20:20:35 | [diff] [blame] | 32 | if __name__ == "__main__": |
33 | unittest.main() |