| 1 |
// Copyright 2024 The Jujutsu Authors |
| 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 |
// https://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 |
use insta::assert_snapshot; |
| 16 |
|
| 17 |
use crate::common::TestEnvironment; |
| 18 |
|
| 19 |
const PREAMBLE: &str = r#" |
| 20 |
<!-- BEGIN MARKDOWN--> |
| 21 |
|
| 22 |
"#; |
| 23 |
|
| 24 |
#[test] |
| 25 |
fn test_generate_markdown_docs_in_docs_dir() { |
| 26 |
let test_env = TestEnvironment::default(); |
| 27 |
let mut markdown_help = PREAMBLE.to_string(); |
| 28 |
markdown_help.push_str( |
| 29 |
test_env |
| 30 |
.run_jj_in(".", ["util", "markdown-help"]) |
| 31 |
.success() |
| 32 |
.stdout |
| 33 |
.raw(), |
| 34 |
); |
| 35 |
|
| 36 |
insta::with_settings!({ |
| 37 |
snapshot_path => ".", |
| 38 |
snapshot_suffix => ".md", |
| 39 |
prepend_module_to_snapshot => false, |
| 40 |
omit_expression => true, |
| 41 |
description => "AUTO-GENERATED FILE, DO NOT EDIT. This cli reference is generated \ |
| 42 |
by a test as an `insta` snapshot. MkDocs includes this snapshot \ |
| 43 |
from docs/cli-reference.md.", |
| 44 |
}, |
| 45 |
{ assert_snapshot!("cli-reference", markdown_help) }); |
| 46 |
} |