diff options
author | 2017-02-23 20:20:15 +0000 | |
---|---|---|
committer | 2017-02-24 08:29:57 +0000 | |
commit | 67fa75a4bd5bb1f602d7f4575e2cf2bed77bbb97 (patch) | |
tree | c1d6c510b4b8d099340e035a8a4ec98ea1f92c18 /src/test/java/com/google/devtools | |
parent | 6731efe77088cb054cc595449888a6eccab397a4 (diff) |
Add is_external support to PackageManifestParser.
--
PiperOrigin-RevId: 148375330
MOS_MIGRATED_REVID=148375330
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r-- | src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java b/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java index f2628d2457..9fac92c48c 100644 --- a/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java +++ b/src/test/java/com/google/devtools/build/android/ideinfo/ArtifactLocationConverterTest.java @@ -20,14 +20,12 @@ import static org.junit.Assert.fail; import com.google.common.base.Joiner; import com.google.devtools.build.lib.ideinfo.androidstudio.PackageManifestOuterClass.ArtifactLocation; import com.google.devtools.common.options.OptionsParsingException; - +import java.nio.file.Paths; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import java.nio.file.Paths; - /** * Tests {@link ArtifactLocationConverter}. */ @@ -69,24 +67,32 @@ public class ArtifactLocationConverterTest { } @Test - public void testInvalidFormatFails() throws Exception { - assertFails("/root", "Expected either 2 or 3 comma-separated paths"); - assertFails("/root,exec,rel,extra", "Expected either 2 or 3 comma-separated paths"); - } - - @Test - public void testOldFormat() throws Exception { - ArtifactLocation parsed = converter - .convert("bin/out,java/com/test.java,/usr/local/_tmp/code/bin/out"); - assertThat(parsed) + public void testConverterExternal() throws Exception { + ArtifactLocation externalArtifact = + converter.convert(Joiner.on(',').join("", "test.java", "1")); + assertThat(externalArtifact) .isEqualTo( ArtifactLocation.newBuilder() - .setRootExecutionPathFragment(Paths.get("bin/out").toString()) - .setRelativePath(Paths.get("java/com/test.java").toString()) - .setIsSource(false) + .setRelativePath(Paths.get("test.java").toString()) + .setIsSource(true) + .setIsExternal(true) + .build()); + ArtifactLocation nonExternalArtifact = + converter.convert(Joiner.on(',').join("", "test.java", "0")); + assertThat(nonExternalArtifact) + .isEqualTo( + ArtifactLocation.newBuilder() + .setRelativePath(Paths.get("test.java").toString()) + .setIsSource(true) + .setIsExternal(false) .build()); } + @Test + public void testInvalidFormatFails() throws Exception { + assertFails("/root", ArtifactLocationConverter.INVALID_FORMAT); + assertFails("/root,exec,rel,extra", ArtifactLocationConverter.INVALID_FORMAT); + } private void assertFails(String input, String expectedError) { try { |