blob: c68badc76e9711341bcada204d42b6ae3b121710 [file] [log] [blame]
Dmitry Lomov251d7542015-11-18 16:16:22 +00001// 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
15package com.google.devtools.build.lib.packages;
16
17import static java.nio.charset.StandardCharsets.UTF_8;
18
ccalvarin5e5ee0d2018-08-23 08:56:01 -070019import com.google.common.collect.ImmutableSet;
Dmitry Lomov251d7542015-11-18 16:16:22 +000020import com.google.common.io.Files;
michajlo7131b2c2018-04-09 09:25:50 -070021import com.google.devtools.build.lib.bazel.Bazel;
Dmitry Lomov251d7542015-11-18 16:16:22 +000022import com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider;
Laszlo Csomor4d05f382018-11-22 07:53:57 -080023import com.google.devtools.build.runfiles.Runfiles;
Liam Miller-Cushon650e8752016-11-15 20:38:07 +000024import java.io.File;
Dmitry Lomov251d7542015-11-18 16:16:22 +000025import org.junit.Test;
26import org.junit.runner.RunWith;
27import org.junit.runners.JUnit4;
28
Dmitry Lomov251d7542015-11-18 16:16:22 +000029/**
30 * Test for Bazel documentation.
31 */
32@RunWith(JUnit4.class)
33public class BazelDocumentationTest {
jhorvitz33f76482021-10-28 10:13:26 -070034
Dmitry Lomov251d7542015-11-18 16:16:22 +000035 /**
dmartingcdb8a632017-09-04 11:43:35 +020036 * Checks that the user-manual is in sync with the {@link
jhorvitz33f76482021-10-28 10:13:26 -070037 * com.google.devtools.build.lib.analysis.config.BuildConfigurationValue}.
Dmitry Lomov251d7542015-11-18 16:16:22 +000038 */
39 @Test
40 public void testBazelUserManual() throws Exception {
Laszlo Csomor4d05f382018-11-22 07:53:57 -080041 Runfiles runfiles = Runfiles.create();
fweb66fa332022-02-18 04:03:10 -080042 String documentationFilePath =
43 runfiles.rlocation("io_bazel/site/en/docs/user-manual.md");
Yun Peng6e06d192016-07-05 15:02:26 +000044 final File documentationFile = new File(documentationFilePath);
Dmitry Lomov251d7542015-11-18 16:16:22 +000045 DocumentationTestUtil.validateUserManual(
michajlo7131b2c2018-04-09 09:25:50 -070046 Bazel.BAZEL_MODULES,
Dmitry Lomov251d7542015-11-18 16:16:22 +000047 BazelRuleClassProvider.create(),
ccalvarin5e5ee0d2018-08-23 08:56:01 -070048 Files.asCharSource(documentationFile, UTF_8).read(),
49 ImmutableSet.of());
Dmitry Lomov251d7542015-11-18 16:16:22 +000050 }
51}