blob: e8e8d445a7987cb4771c98b6e5842010cb944414 [file] [log] [blame]
Don Garrettfb15e322016-06-21 19:12:08 -07001#!/usr/bin/python2
2
David Rochberg7c79a812011-01-19 14:24:45 -05003# 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 Arnoldabb352e2012-09-23 01:24:27 -07006
Don Garrettfb15e322016-06-21 19:12:08 -07007"""Unittests for builder.py."""
8
9from __future__ import print_function
10
David Rochberg7c79a812011-01-19 14:24:45 -050011import subprocess
12import unittest
13
14import builder
15
Don Garrettfb15e322016-06-21 19:12:08 -070016# pylint: disable=protected-access
David Rochberg7c79a812011-01-19 14:24:45 -050017
18class BuilderTest(unittest.TestCase):
Don Garrettfb15e322016-06-21 19:12:08 -070019 """Tests for builder."""
David Rochberg7c79a812011-01-19 14:24:45 -050020 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
29if __name__ == '__main__':
30 unittest.main()