diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java index 6dc45745d3..a1137cd02d 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderIntegrationTest.java @@ -63,4 +63,36 @@ public class LocationExpanderIntegrationTest extends BuildViewTestCase { assertThat(result).isEqualTo("foo 'spaces/file with space A' 'spaces/file with space B' bar"); } + + @Test + public void otherPathExpansion() throws Exception { + scratch.file( + "expansion/BUILD", + "genrule(name='foo', outs=['foo.txt'], cmd='never executed')", + "sh_library(name='lib', srcs=[':foo'])"); + + LocationExpander expander = makeExpander("//expansion:lib"); + assertThat(expander.expand("foo $(execpath :foo) bar")) + .matches("foo .*-out/.*/expansion/foo\\.txt bar"); + assertThat(expander.expand("foo $(execpaths :foo) bar")) + .matches("foo .*-out/.*/expansion/foo\\.txt bar"); + assertThat(expander.expand("foo $(rootpath :foo) bar")) + .matches("foo expansion/foo.txt bar"); + assertThat(expander.expand("foo $(rootpaths :foo) bar")) + .matches("foo expansion/foo.txt bar"); + } + + @Test + public void otherPathMultiExpansion() throws Exception { + scratch.file( + "expansion/BUILD", + "genrule(name='foo', outs=['foo.txt', 'bar.txt'], cmd='never executed')", + "sh_library(name='lib', srcs=[':foo'])"); + + LocationExpander expander = makeExpander("//expansion:lib"); + assertThat(expander.expand("foo $(execpaths :foo) bar")) + .matches("foo .*-out/.*/expansion/bar\\.txt .*-out/.*/expansion/foo\\.txt bar"); + assertThat(expander.expand("foo $(rootpaths :foo) bar")) + .matches("foo expansion/bar.txt expansion/foo.txt bar"); + } } |