mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
https://bugs.swift.org/browse/SR-237 calls for `build-script` and `build-script-impl` to be merged. This commit takes another step towards that goal by moving the logic that finds the path to the `clang` and `clang++` executables up into Python-land. Rather than simply moving all of the logic into `utils/build-script`, this commit moves relevant functions into a new Python module, named `swift_build_support`. This has several benefits: - The logic can be tested. Whereas `build-script-impl` needed to be run in order to verify its behavior, the logic extracted out of it into `swift_build_support` can be tested in isolation. - The logic can be split up into several files without polluting the `utils` directory, which now contains many different files that are unrelated to `build-script`.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# test_migration.py - Tests for swift_build_support.migration -*- python -*-
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See http://swift.org/LICENSE.txt for license information
|
|
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
import unittest
|
|
|
|
from swift_build_support.migration import migrate_impl_args
|
|
|
|
|
|
class MigrateImplArgsTestCase(unittest.TestCase):
|
|
def test_args_moved_before_separator(self):
|
|
# Tests that '-RT --foo=bar -- --foo=baz --flim' is parsed as
|
|
# '-RT --foo=bar --foo=baz -- --flim'
|
|
args = migrate_impl_args(
|
|
['-RT', '--darwin-xcrun-toolchain=foo', '--',
|
|
'--darwin-xcrun-toolchain=bar', '--other'],
|
|
['--darwin-xcrun-toolchain'])
|
|
|
|
self.assertEqual(
|
|
args,
|
|
['-RT', '--darwin-xcrun-toolchain=foo',
|
|
'--darwin-xcrun-toolchain=bar', '--', '--other'])
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|