# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os import unittest
from mozunit import main from six import StringIO
from mozbuild.makeutil import Makefile, Rule, read_dep_makefile, write_dep_makefile
class TestMakefile(unittest.TestCase): def test_rule(self):
out = StringIO()
rule = Rule()
rule.dump(out)
self.assertEqual(out.getvalue(), "")
out = StringIO()
rule.add_targets(["foo", "bar"])
rule.dump(out)
self.assertEqual(out.getvalue(), "foo bar:\n")
out = StringIO()
rule.add_targets(["baz"])
rule.add_dependencies(["qux", "hoge", "piyo"])
rule.dump(out)
self.assertEqual(out.getvalue(), "foo bar baz: qux hoge piyo\n")
def test_write_dep_makefile(self):
out = StringIO()
write_dep_makefile(out, "target", ["b", "c", "a"])
self.assertEqual(out.getvalue(), "target: b c a\n" + "a b c:\n")
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.