laszlocsomor | f4b6ac6 | 2020-02-06 01:13:44 -0800 | [diff] [blame] | 1 | // Copyright 2020 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package com.google.devtools.build.lib.analysis; |
| 15 | |
| 16 | import com.google.devtools.build.lib.analysis.configuredtargets.PackageGroupConfiguredTarget; |
| 17 | import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; |
| 18 | import org.junit.Test; |
| 19 | import org.junit.runner.RunWith; |
| 20 | import org.junit.runners.JUnit4; |
| 21 | |
| 22 | /** |
| 23 | * Tests for {@link PackageGroupConfiguredTarget}. |
| 24 | */ |
| 25 | @RunWith(JUnit4.class) |
| 26 | public final class PackageGroupBuildViewTest extends BuildViewTestCase { |
| 27 | /** Regression test for bug #3445835. */ |
| 28 | @Test |
| 29 | public void testPackageGroupInDeps() throws Exception { |
| 30 | checkError("foo", "bar", "in deps attribute of cc_library rule //foo:bar: " |
| 31 | + "package group '//foo:foo' is misplaced here ", |
| 32 | "package_group(name = 'foo', packages = ['//none'])", |
| 33 | "cc_library(name = 'bar', deps = [':foo'])"); |
| 34 | } |
| 35 | |
| 36 | @Test |
| 37 | public void testPackageGroupInData() throws Exception { |
| 38 | checkError( |
| 39 | "foo", |
| 40 | "bar", |
| 41 | "in data attribute of cc_library rule //foo:bar: " |
| 42 | + "package group '//foo:foo' is misplaced here ", |
| 43 | "package_group(name = 'foo', packages = ['//none'])", |
| 44 | "cc_library(name = 'bar', data = [':foo'])"); |
| 45 | } |
| 46 | } |