Mercurial > public > mercurial-scm > hg
annotate contrib/merge-lists/tests/test-merge-lists.rs @ 49010:681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
This is a pretty naive tool that uses a regular expression for
matching lines. It is based on a Google-internal tool that worked in a
similar way.
For now, the regular expression is hard-coded to attempt to match
single-line Python imports. The only commit I've found in the hg core
repo where the tool helped was commit 9cd6292abfdf. I think that's
because we often use multiple imports per import statement. I think
this tool is still a decent first step (especially once the regex is
made configurable in the next patch). The merging should ideally use a
proper Python parser and do the merge at the AST (or CST?) level, but
that's significantly harder, especially if you want to preserve
comments and whitespace. It's also less generic.
Differential Revision: https://phab.mercurial-scm.org/D12380
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 04 Mar 2022 16:12:56 -0800 |
parents | |
children | b999edb15f8c |
rev | line source |
---|---|
49010
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
1 use similar::DiffableStr; |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
2 use tempdir::TempDir; |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
4 fn run_test(input: &str) -> String { |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
5 let mut cmd = assert_cmd::Command::cargo_bin("merge-lists").unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
6 let temp_dir = TempDir::new("test").unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
7 let base_path = temp_dir.path().join("base"); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
8 let local_path = temp_dir.path().join("local"); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
9 let other_path = temp_dir.path().join("other"); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
10 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
11 let rest = input.strip_prefix("\nbase:\n").unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
12 let mut split = rest.split("\nlocal:\n"); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
13 std::fs::write(&base_path, split.next().unwrap()).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
14 let rest = split.next().unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
15 let mut split = rest.split("\nother:\n"); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
16 std::fs::write(&local_path, split.next().unwrap()).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
17 std::fs::write(&other_path, split.next().unwrap()).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
18 cmd.args(&[ |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
19 local_path.as_os_str(), |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
20 base_path.as_os_str(), |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
21 other_path.as_os_str(), |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
22 ]) |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
23 .assert() |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
24 .success(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
25 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
26 let new_base_bytes = std::fs::read(&base_path).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
27 let new_local_bytes = std::fs::read(&local_path).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
28 let new_other_bytes = std::fs::read(&other_path).unwrap(); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
29 // No newline before "base:" because of https://github.com/mitsuhiko/insta/issues/117 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
30 format!( |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
31 "base:\n{}\nlocal:\n{}\nother:\n{}", |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
32 new_base_bytes.as_str().unwrap(), |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
33 new_local_bytes.as_str().unwrap(), |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
34 new_other_bytes.as_str().unwrap() |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
35 ) |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
36 } |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
37 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
38 #[test] |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
39 fn test_merge_lists_basic() { |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
40 let output = run_test( |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
41 r" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
42 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
43 import lib1 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
44 import lib2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
45 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
46 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
47 import lib2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
48 import lib3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
49 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
50 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
51 import lib3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
52 import lib4 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
53 ", |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
54 ); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
55 insta::assert_snapshot!(output, @r###" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
56 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
57 import lib3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
58 import lib4 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
59 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
60 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
61 import lib3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
62 import lib4 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
63 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
64 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
65 import lib3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
66 import lib4 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
67 "###); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
68 } |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
69 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
70 #[test] |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
71 fn test_merge_lists_from() { |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
72 // Test some "from x import y" statements and some non-import conflicts |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
73 // (unresolvable) |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
74 let output = run_test( |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
75 r" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
76 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
77 from . import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
78 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
79 1+1 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
80 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
81 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
82 from . import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
83 from a import b |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
84 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
85 2+2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
86 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
87 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
88 from a import c |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
89 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
90 3+3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
91 ", |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
92 ); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
93 insta::assert_snapshot!(output, @r###" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
94 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
95 from a import b |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
96 from a import c |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
97 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
98 1+1 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
99 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
100 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
101 from a import b |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
102 from a import c |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
103 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
104 2+2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
105 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
106 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
107 from a import b |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
108 from a import c |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
109 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
110 3+3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
111 "###); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
112 } |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
113 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
114 #[test] |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
115 fn test_merge_lists_not_sorted() { |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
116 // Test that nothing is done if the elements in the conflicting hunks are |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
117 // not sorted |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
118 let output = run_test( |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
119 r" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
120 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
121 import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
122 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
123 1+1 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
124 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
125 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
126 import a |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
127 import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
128 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
129 2+2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
130 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
131 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
132 import z |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
133 import y |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
134 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
135 3+3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
136 ", |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
137 ); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
138 insta::assert_snapshot!(output, @r###" |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
139 base: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
140 import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
141 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
142 1+1 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
143 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
144 local: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
145 import a |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
146 import x |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
147 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
148 2+2 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
149 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
150 other: |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
151 import z |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
152 import y |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
153 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
154 3+3 |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
155 "###); |
681b25ea579e
contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
156 } |