diff options
author | 2015-12-01 14:38:06 +0000 | |
---|---|---|
committer | 2015-12-01 18:24:46 +0000 | |
commit | 432d19896ebac584a76a89f5a5f8e69ae28907d5 (patch) | |
tree | 70782a9d369a5d127907916a067d5fdf9f90b59a /src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java | |
parent | 0220dc742f968d9d65b06d8cc52e2216e9525147 (diff) |
Migrated tests in devtools/build/lib/packages to JUnit 4.
--
MOS_MIGRATED_REVID=109079812
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java b/src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java index c09de9f844..bca3b28777 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/RuleFactoryTest.java @@ -14,6 +14,11 @@ package com.google.devtools.build.lib.packages; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -22,21 +27,27 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.PackageIdentifier; import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.events.Reporter; -import com.google.devtools.build.lib.packages.util.PackageLoadingTestCase; +import com.google.devtools.build.lib.packages.util.PackageLoadingTestCaseForJunit4; import com.google.devtools.build.lib.syntax.Type; import com.google.devtools.build.lib.testutil.TestRuleClassProvider; import com.google.devtools.build.lib.vfs.Path; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + import java.util.HashMap; import java.util.Map; -public class RuleFactoryTest extends PackageLoadingTestCase { +@RunWith(JUnit4.class) +public class RuleFactoryTest extends PackageLoadingTestCaseForJunit4 { private ConfiguredRuleClassProvider provider = TestRuleClassProvider.getRuleClassProvider(); private RuleFactory ruleFactory = new RuleFactory(provider); public static final Location LOCATION_42 = Location.fromFileAndOffsets(null, 42, 42); + @Test public void testCreateRule() throws Exception { Path myPkgPath = scratch.resolve("/foo/workspace/mypkg/BUILD"); Package.Builder pkgBuilder = @@ -98,6 +109,7 @@ public class RuleFactoryTest extends PackageLoadingTestCase { assertThat(attributes.get("srcs", BuildType.LABEL_LIST)).isEmpty(); } + @Test public void testCreateWorkspaceRule() throws Exception { Path myPkgPath = scratch.resolve("/foo/workspace/WORKSPACE"); Package.Builder pkgBuilder = Package.newExternalPackageBuilder(myPkgPath, "TESTING"); @@ -118,6 +130,7 @@ public class RuleFactoryTest extends PackageLoadingTestCase { assertFalse(rule.containsErrors()); } + @Test public void testWorkspaceRuleFailsInBuildFile() throws Exception { Path myPkgPath = scratch.resolve("/foo/workspace/mypkg/BUILD"); Package.Builder pkgBuilder = @@ -144,6 +157,7 @@ public class RuleFactoryTest extends PackageLoadingTestCase { } } + @Test public void testBuildRuleFailsInWorkspaceFile() throws Exception { Path myPkgPath = scratch.resolve("/foo/workspace/WORKSPACE"); Package.Builder pkgBuilder = @@ -182,6 +196,7 @@ public class RuleFactoryTest extends PackageLoadingTestCase { ruleClass.hasAttr(attrName, type)); } + @Test public void testOutputFileNotEqualDot() throws Exception { Path myPkgPath = scratch.resolve("/foo"); Package.Builder pkgBuilder = @@ -212,6 +227,7 @@ public class RuleFactoryTest extends PackageLoadingTestCase { */ // TODO(ulfjack): Remove this check when we switch over to the builder // pattern, which will always guarantee that these attributes are present. + @Test public void testTestRules() throws Exception { Path myPkgPath = scratch.resolve("/foo/workspace/mypkg/BUILD"); Package pkg = |