aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2016-07-12 18:05:06 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-07-13 11:15:39 +0000
commitbc08ee7963816bbd361cc3043dec54f4e58a4bdb (patch)
treeb9987a39984e7f83374b6b3d457a58dfaf54b3bd /src/test/java/com/google/devtools/build
parent63d472608aa2c7fb2f69b5d3107ecfce17426b3f (diff)
Fix native.existing_rule() when argument is an existing file
-- MOS_MIGRATED_REVID=127218963
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java
index 1a430ed4b3..9f6d170b5c 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java
@@ -475,6 +475,24 @@ public class SkylarkRuleContextTest extends SkylarkTestCase {
}
@Test
+ public void testExistingRuleReturnNone() throws Exception {
+ scratch.file(
+ "test/rulestr.bzl",
+ "def test_rule(name, x):",
+ " print(native.existing_rule(x))",
+ " if native.existing_rule(x) == None:",
+ " native.cc_library(name = name)");
+ scratch.file(
+ "test/BUILD",
+ "load('//test:rulestr.bzl', 'test_rule')",
+ "test_rule('a', 'does not exist')",
+ "test_rule('b', 'BUILD')");
+
+ assertNotNull(getConfiguredTarget("//test:a"));
+ assertNotNull(getConfiguredTarget("//test:b"));
+ }
+
+ @Test
public void testGetRule() throws Exception {
scratch.file("test/skylark/BUILD");
scratch.file(