OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """Unit tests for //tools/licenses.py. |
| 7 """ |
| 8 |
| 9 import os |
| 10 import sys |
| 11 import unittest |
| 12 |
| 13 REPOSITORY_ROOT = os.path.abspath(os.path.join( |
| 14 os.path.dirname(__file__), '..', '..')) |
| 15 sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools')) |
| 16 |
| 17 import licenses |
| 18 |
| 19 |
| 20 class LicensesTest(unittest.TestCase): |
| 21 |
| 22 def test_get_third_party_deps_from_gn_deps_output(self): |
| 23 third_party_deps = licenses.GetThirdPartyDepsFromGNDepsOutput( |
| 24 '/home/example/src/net/BUILD.gn\n' |
| 25 '/home/example/src/third_party/zlib/BUILD.gn\n' |
| 26 '/home/example/src/third_party/cld_3/src/src/BUILD.gn\n') |
| 27 |
| 28 # '/home/example/src/net' is not in the output because it's not a |
| 29 # third_party dependency. |
| 30 # |
| 31 # It must return the direct sub-directory of "third_party". So it should |
| 32 # return '/home/example/src/third_party/cld_3', not |
| 33 # '/home/example/src/third_party/cld_3/src/src'. |
| 34 assert third_party_deps == set([ |
| 35 '/home/example/src/third_party/zlib', |
| 36 '/home/example/src/third_party/cld_3', |
| 37 ]) |
| 38 |
| 39 |
| 40 if __name__ == '__main__': |
| 41 unittest.main() |
OLD | NEW |