Add StarlarkCcCommonTest for local_defines
#codehealth
RELNOTES:none
@@ -5509,6 +5509,17 @@ public class StarlarkCcCommonTest extends BuildViewTestCase {
assertThat(action.getArguments()).containsAtLeast("-DDEFINE1", "-DDEFINE2");
}
+ @Test
+ public void testLocalDefines() throws Exception {
+ createFilesForTestingCompilation(
+ scratch, "tools/build_defs/foo", "local_defines=['DEFINE1', 'DEFINE2']");
+ ConfiguredTarget target = getConfiguredTarget("//foo:starlark_lib");
+ assertThat(target).isNotNull();
+ CppCompileAction action =
+ (CppCompileAction) getGeneratingAction(artifactByPath(getFilesToBuild(target), ".o"));
+ assertThat(action.getArguments()).containsAtLeast("-DDEFINE1", "-DDEFINE2");
+ }
+
@Test
public void testHeaders() throws Exception {
createFilesForTestingCompilation(
