blob: 009f3cbdbf886b15aa0e71bb605fc6ea39b8c7ed [file] [log] [blame]
Mike Frysingera7f08bc2019-08-27 19:16:331#!/usr/bin/env python2
2# -*- coding: utf-8 -*-
Mike Frysinger8b0fc372022-09-08 07:24:243# Copyright 2010 The ChromiumOS Authors
David Rochberg7c79a812011-01-19 19:24:454# 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 08:24:276
Don Garrettfb15e322016-06-22 02:12:087"""Unittests for builder.py."""
8
9from __future__ import print_function
10
David Rochberg7c79a812011-01-19 19:24:4511import subprocess
12import unittest
13
14import builder
15
Jack Rosenthal8de609d2023-02-09 20:20:3516
Don Garrettfb15e322016-06-22 02:12:0817# pylint: disable=protected-access
David Rochberg7c79a812011-01-19 19:24:4518
Jack Rosenthal8de609d2023-02-09 20:20:3519
David Rochberg7c79a812011-01-19 19:24:4520class BuilderTest(unittest.TestCase):
Jack Rosenthal8de609d2023-02-09 20:20:3521 """Tests for builder."""
David Rochberg7c79a812011-01-19 19:24:4522
Jack Rosenthal8de609d2023-02-09 20:20:3523 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 Rochberg7c79a812011-01-19 19:24:4530
31
Jack Rosenthal8de609d2023-02-09 20:20:3532if __name__ == "__main__":
33 unittest.main()