| 1 |
// Copyright 2020 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 crate::common::TestEnvironment; |
| 16 |
|
| 17 |
#[test] |
| 18 |
fn test_init_local() { |
| 19 |
let test_env = TestEnvironment::default(); |
| 20 |
let output = test_env.run_jj_in(".", ["debug", "init-simple", "repo"]); |
| 21 |
insta::assert_snapshot!(output, @r#" |
| 22 |
------- stderr ------- |
| 23 |
Initialized repo in "repo" |
| 24 |
[EOF] |
| 25 |
"#); |
| 26 |
|
| 27 |
let workspace_root = test_env.env_root().join("repo"); |
| 28 |
let jj_path = workspace_root.join(".jj"); |
| 29 |
let repo_path = jj_path.join("repo"); |
| 30 |
let store_path = repo_path.join("store"); |
| 31 |
assert!(workspace_root.is_dir()); |
| 32 |
assert!(jj_path.is_dir()); |
| 33 |
assert!(jj_path.join("working_copy").is_dir()); |
| 34 |
assert!(repo_path.is_dir()); |
| 35 |
assert!(store_path.is_dir()); |
| 36 |
assert!(store_path.join("commits").is_dir()); |
| 37 |
assert!(store_path.join("trees").is_dir()); |
| 38 |
assert!(store_path.join("files").is_dir()); |
| 39 |
assert!(store_path.join("symlinks").is_dir()); |
| 40 |
assert!(store_path.join("conflicts").is_dir()); |
| 41 |
|
| 42 |
let output = test_env.run_jj_in( |
| 43 |
".", |
| 44 |
["debug", "init-simple", "--no-integrate-operation", "repo2"], |
| 45 |
); |
| 46 |
insta::assert_snapshot!(output, @" |
| 47 |
------- stderr ------- |
| 48 |
Error: --no-integrate-operation is not respected |
| 49 |
[EOF] |
| 50 |
[exit status: 2] |
| 51 |
"); |
| 52 |
|
| 53 |
let output = test_env.run_jj_in( |
| 54 |
".", |
| 55 |
["debug", "init-simple", "--ignore-working-copy", "repo2"], |
| 56 |
); |
| 57 |
insta::assert_snapshot!(output, @" |
| 58 |
------- stderr ------- |
| 59 |
Error: --ignore-working-copy is not respected |
| 60 |
[EOF] |
| 61 |
[exit status: 2] |
| 62 |
"); |
| 63 |
|
| 64 |
let output = test_env.run_jj_in(".", ["debug", "init-simple", "--at-op=@-", "repo3"]); |
| 65 |
insta::assert_snapshot!(output, @" |
| 66 |
------- stderr ------- |
| 67 |
Error: --at-op is not respected |
| 68 |
[EOF] |
| 69 |
[exit status: 2] |
| 70 |
"); |
| 71 |
} |