|
| 1 | +"""Tests for `launchd_plists.get_file_from_objc_provider`.""" |
| 2 | + |
| 3 | +load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") |
| 4 | + |
| 5 | +# buildifier: disable=bzl-visibility |
| 6 | +load("//xcodeproj/internal:launchd_plists.bzl", "launchd_plists") |
| 7 | + |
| 8 | +def _get_file_from_objc_provider_test(ctx): |
| 9 | + env = unittest.begin(ctx) |
| 10 | + |
| 11 | + launchd_plist_file = ctx.actions.declare_file("Launchd.plist") |
| 12 | + ctx.actions.write(launchd_plist_file, content = "") |
| 13 | + launchd_plist_path = launchd_plist_file.path |
| 14 | + |
| 15 | + linkopt_list = [ |
| 16 | + "-Wl,-sectcreate,__TEXT,__launchd_plist,{}".format(launchd_plist_path), |
| 17 | + ] |
| 18 | + link_inputs_list = [launchd_plist_file] |
| 19 | + linkopt_depset = depset(linkopt_list) |
| 20 | + link_inputs_depset = depset(link_inputs_list) |
| 21 | + |
| 22 | + objc_prov = apple_common.new_objc_provider( |
| 23 | + linkopt = linkopt_depset, |
| 24 | + link_inputs = link_inputs_depset, |
| 25 | + ) |
| 26 | + |
| 27 | + actual = launchd_plists.get_file_from_objc_provider(objc_prov) |
| 28 | + asserts.equals(env, launchd_plist_file, actual) |
| 29 | + |
| 30 | + return unittest.end(env) |
| 31 | + |
| 32 | +get_file_from_objc_provider_test = unittest.make( |
| 33 | + _get_file_from_objc_provider_test, |
| 34 | +) |
| 35 | + |
| 36 | +def get_file_from_objc_provider_test_suite(name): |
| 37 | + return unittest.suite( |
| 38 | + name, |
| 39 | + get_file_from_objc_provider_test, |
| 40 | + ) |
0 commit comments