Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 1 | // Copyright 2015 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 | |
| 15 | package com.google.devtools.build.lib.packages; |
| 16 | |
| 17 | import static java.nio.charset.StandardCharsets.UTF_8; |
| 18 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableSet; |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 20 | import com.google.common.io.Files; |
michajlo | 7131b2c | 2018-04-09 09:25:50 -0700 | [diff] [blame] | 21 | import com.google.devtools.build.lib.bazel.Bazel; |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 22 | import com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider; |
Laszlo Csomor | 4d05f38 | 2018-11-22 07:53:57 -0800 | [diff] [blame] | 23 | import com.google.devtools.build.runfiles.Runfiles; |
Liam Miller-Cushon | 650e875 | 2016-11-15 20:38:07 +0000 | [diff] [blame] | 24 | import java.io.File; |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 25 | import org.junit.Test; |
| 26 | import org.junit.runner.RunWith; |
| 27 | import org.junit.runners.JUnit4; |
| 28 | |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 29 | /** |
| 30 | * Test for Bazel documentation. |
| 31 | */ |
| 32 | @RunWith(JUnit4.class) |
| 33 | public class BazelDocumentationTest { |
jhorvitz | 33f7648 | 2021-10-28 10:13:26 -0700 | [diff] [blame] | 34 | |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 35 | /** |
dmarting | cdb8a63 | 2017-09-04 11:43:35 +0200 | [diff] [blame] | 36 | * Checks that the user-manual is in sync with the {@link |
jhorvitz | 33f7648 | 2021-10-28 10:13:26 -0700 | [diff] [blame] | 37 | * com.google.devtools.build.lib.analysis.config.BuildConfigurationValue}. |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 38 | */ |
| 39 | @Test |
| 40 | public void testBazelUserManual() throws Exception { |
Laszlo Csomor | 4d05f38 | 2018-11-22 07:53:57 -0800 | [diff] [blame] | 41 | Runfiles runfiles = Runfiles.create(); |
fwe | b66fa33 | 2022-02-18 04:03:10 -0800 | [diff] [blame^] | 42 | String documentationFilePath = |
| 43 | runfiles.rlocation("io_bazel/site/en/docs/user-manual.md"); |
Yun Peng | 6e06d19 | 2016-07-05 15:02:26 +0000 | [diff] [blame] | 44 | final File documentationFile = new File(documentationFilePath); |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 45 | DocumentationTestUtil.validateUserManual( |
michajlo | 7131b2c | 2018-04-09 09:25:50 -0700 | [diff] [blame] | 46 | Bazel.BAZEL_MODULES, |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 47 | BazelRuleClassProvider.create(), |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 48 | Files.asCharSource(documentationFile, UTF_8).read(), |
| 49 | ImmutableSet.of()); |
Dmitry Lomov | 251d754 | 2015-11-18 16:16:22 +0000 | [diff] [blame] | 50 | } |
| 51 | } |