Debian Codegraph @

cli/tests/test_copy_detection.rs

raw
1 // Copyright 2022 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_simple_rename() {
19 let test_env = TestEnvironment::default();
20 test_env.run_jj_in(".", ["git", "init", "repo"]).success();
21 let work_dir = test_env.work_dir("repo");
22
23 work_dir.run_jj(["new"]).success();
24 work_dir.write_file("original", "original");
25 work_dir.write_file("something", "something");
26 work_dir.run_jj(["commit", "-mfirst"]).success();
27 work_dir.remove_file("original");
28 work_dir.write_file("modified", "original");
29 work_dir.write_file("something", "changed");
30 insta::assert_snapshot!(
31 work_dir.run_jj(["debug", "copy-detection"]).normalize_backslash(), @"
32 original -> modified
33 [EOF]
34 ");
35 }