type-rename-move 0.0.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/bin/trmv-compliance.js +4 -0
- package/dist/bin/trmv-config.js +4 -0
- package/dist/bin/trmv-doctor.js +4 -0
- package/dist/bin/trmv-mock-lint.js +4 -0
- package/dist/bin/trmv-refactor.js +4 -0
- package/dist/bin/trmv-typecheck.js +4 -0
- package/dist/changes/index.d.ts +24 -0
- package/dist/changes/index.js +112 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +36 -0
- package/dist/config/command.d.ts +20 -0
- package/dist/config/command.js +68 -0
- package/dist/config/error.d.ts +3 -0
- package/dist/config/error.js +4 -0
- package/dist/config/files.d.ts +6 -0
- package/dist/config/files.js +29 -0
- package/dist/config/format.d.ts +25 -0
- package/dist/config/format.js +172 -0
- package/dist/config/index.d.ts +73 -0
- package/dist/config/index.js +239 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.js +37 -0
- package/dist/contract/data/CONTRACT_HASH +1 -0
- package/dist/contract/data/README.md +69 -0
- package/dist/contract/data/cli.yaml +239 -0
- package/dist/contract/data/config.yaml +8 -0
- package/dist/contract/data/findings.yaml +212 -0
- package/dist/contract/data/languages.yaml +146 -0
- package/dist/contract/data/regex-subset.md +28 -0
- package/dist/contract/data/schema/rename-map.schema.json +51 -0
- package/dist/contract/data/schema/trmv.schema.json +92 -0
- package/dist/contract/data/schema/word-table.schema.json +55 -0
- package/dist/contract/data/vectors/cli.yaml +216 -0
- package/dist/contract/data/vectors/command-split.yaml +69 -0
- package/dist/contract/data/vectors/diff.yaml +287 -0
- package/dist/contract/data/vectors/format.yaml +160 -0
- package/dist/contract/data/vectors/glob.yaml +148 -0
- package/dist/contract/data/vectors/materialize.yaml +51 -0
- package/dist/contract/data/vectors/os-errors.yaml +123 -0
- package/dist/contract/data/vectors/refactor-symbols.yaml +220 -0
- package/dist/contract/data/vectors/refactor-text.yaml +186 -0
- package/dist/contract/data/vectors/refactor-words.yaml +83 -0
- package/dist/contract/data/vectors/regex-subset.yaml +40 -0
- package/dist/contract/data/vectors/repr.yaml +118 -0
- package/dist/contract/data/vectors/skill-leaks.yaml +6 -0
- package/dist/contract/data/vectors/test-files.yaml +135 -0
- package/dist/contract/data/vectors/yaml.yaml +858 -0
- package/dist/contract/glob.d.ts +3 -0
- package/dist/contract/glob.js +49 -0
- package/dist/contract/index.d.ts +13 -0
- package/dist/contract/index.js +14 -0
- package/dist/contract/json.d.ts +1 -0
- package/dist/contract/json.js +43 -0
- package/dist/contract/os-error.d.ts +13 -0
- package/dist/contract/os-error.js +66 -0
- package/dist/contract/parser.d.ts +18 -0
- package/dist/contract/parser.js +207 -0
- package/dist/contract/plugin.d.ts +5 -0
- package/dist/contract/plugin.js +90 -0
- package/dist/contract/regex.d.ts +5 -0
- package/dist/contract/regex.js +116 -0
- package/dist/contract/render.d.ts +3 -0
- package/dist/contract/render.js +19 -0
- package/dist/contract/schema.d.ts +10 -0
- package/dist/contract/schema.js +139 -0
- package/dist/contract/snapshot.d.ts +47 -0
- package/dist/contract/snapshot.js +129 -0
- package/dist/contract/text.d.ts +14 -0
- package/dist/contract/text.js +56 -0
- package/dist/contract/values.d.ts +24 -0
- package/dist/contract/values.js +127 -0
- package/dist/contract/which.d.ts +4 -0
- package/dist/contract/which.js +27 -0
- package/dist/contract/yaml.d.ts +11 -0
- package/dist/contract/yaml.js +595 -0
- package/dist/doctor/index.d.ts +3 -0
- package/dist/doctor/index.js +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/lang/conventions.d.ts +33 -0
- package/dist/lang/conventions.js +216 -0
- package/dist/lang/edges.d.ts +2 -0
- package/dist/lang/edges.js +142 -0
- package/dist/lang/files.d.ts +28 -0
- package/dist/lang/files.js +122 -0
- package/dist/lang/imports.d.ts +3 -0
- package/dist/lang/imports.js +64 -0
- package/dist/lang/index.d.ts +13 -0
- package/dist/lang/index.js +18 -0
- package/dist/lang/lines.d.ts +21 -0
- package/dist/lang/lines.js +96 -0
- package/dist/lang/projects.d.ts +30 -0
- package/dist/lang/projects.js +115 -0
- package/dist/lang/specifiers.d.ts +7 -0
- package/dist/lang/specifiers.js +88 -0
- package/dist/lang/ts.d.ts +2 -0
- package/dist/lang/ts.js +7 -0
- package/dist/lang/tsc.d.ts +32 -0
- package/dist/lang/tsc.js +130 -0
- package/dist/lang/types.d.ts +27 -0
- package/dist/lang/types.js +4 -0
- package/dist/refactor/baseline.d.ts +13 -0
- package/dist/refactor/baseline.js +148 -0
- package/dist/refactor/bindings.d.ts +76 -0
- package/dist/refactor/bindings.js +594 -0
- package/dist/refactor/carve.d.ts +31 -0
- package/dist/refactor/carve.js +145 -0
- package/dist/refactor/compliance.d.ts +15 -0
- package/dist/refactor/compliance.js +161 -0
- package/dist/refactor/compound.d.ts +5 -0
- package/dist/refactor/compound.js +40 -0
- package/dist/refactor/diff.d.ts +2 -0
- package/dist/refactor/diff.js +170 -0
- package/dist/refactor/edits.d.ts +16 -0
- package/dist/refactor/edits.js +34 -0
- package/dist/refactor/generate.d.ts +4 -0
- package/dist/refactor/generate.js +209 -0
- package/dist/refactor/index.d.ts +11 -0
- package/dist/refactor/index.js +144 -0
- package/dist/refactor/lines.d.ts +13 -0
- package/dist/refactor/lines.js +34 -0
- package/dist/refactor/literal-sources.d.ts +20 -0
- package/dist/refactor/literal-sources.js +243 -0
- package/dist/refactor/map.d.ts +21 -0
- package/dist/refactor/map.js +45 -0
- package/dist/refactor/members.d.ts +68 -0
- package/dist/refactor/members.js +187 -0
- package/dist/refactor/mention-scope.d.ts +19 -0
- package/dist/refactor/mention-scope.js +113 -0
- package/dist/refactor/mentions.d.ts +28 -0
- package/dist/refactor/mentions.js +92 -0
- package/dist/refactor/mocks.d.ts +16 -0
- package/dist/refactor/mocks.js +139 -0
- package/dist/refactor/module-rename.d.ts +17 -0
- package/dist/refactor/module-rename.js +160 -0
- package/dist/refactor/outcomes.d.ts +42 -0
- package/dist/refactor/outcomes.js +61 -0
- package/dist/refactor/own-scope.d.ts +16 -0
- package/dist/refactor/own-scope.js +142 -0
- package/dist/refactor/position.d.ts +34 -0
- package/dist/refactor/position.js +58 -0
- package/dist/refactor/program-check.d.ts +11 -0
- package/dist/refactor/program-check.js +49 -0
- package/dist/refactor/progress.d.ts +27 -0
- package/dist/refactor/progress.js +66 -0
- package/dist/refactor/rename.d.ts +18 -0
- package/dist/refactor/rename.js +1299 -0
- package/dist/refactor/retarget.d.ts +79 -0
- package/dist/refactor/retarget.js +647 -0
- package/dist/refactor/routing.d.ts +19 -0
- package/dist/refactor/routing.js +237 -0
- package/dist/refactor/session.d.ts +81 -0
- package/dist/refactor/session.js +180 -0
- package/dist/refactor/sites.d.ts +62 -0
- package/dist/refactor/sites.js +207 -0
- package/dist/refactor/symbols.d.ts +41 -0
- package/dist/refactor/symbols.js +385 -0
- package/dist/refactor/timings.d.ts +24 -0
- package/dist/refactor/timings.js +79 -0
- package/dist/refactor/typescript.d.ts +5 -0
- package/dist/refactor/typescript.js +279 -0
- package/dist/refactor/words.d.ts +42 -0
- package/dist/refactor/words.js +114 -0
- package/dist/refactor/workspace.d.ts +59 -0
- package/dist/refactor/workspace.js +314 -0
- package/dist/refactor/writer.d.ts +10 -0
- package/dist/refactor/writer.js +110 -0
- package/dist/twin/index.d.ts +50 -0
- package/dist/twin/index.js +180 -0
- package/dist/typecheck/index.d.ts +11 -0
- package/dist/typecheck/index.js +210 -0
- package/package.json +84 -3
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# (path, old, new) -> the unified diff trmv-refactor prints for one changed file, as rope prints it:
|
|
2
|
+
# difflib.unified_diff over str.splitlines(keepends=True), labels a/<path> and b/<path>, three context
|
|
3
|
+
# lines, no end-of-file marker. Every twin's formatter reproduces each `diff` byte for byte.
|
|
4
|
+
cases:
|
|
5
|
+
- name: one changed line, three context lines
|
|
6
|
+
path: src/a.ts
|
|
7
|
+
old: |
|
|
8
|
+
line 1
|
|
9
|
+
line 2
|
|
10
|
+
line 3
|
|
11
|
+
line 4
|
|
12
|
+
line 5
|
|
13
|
+
line 6
|
|
14
|
+
line 7
|
|
15
|
+
line 8
|
|
16
|
+
line 9
|
|
17
|
+
line 10
|
|
18
|
+
line 11
|
|
19
|
+
line 12
|
|
20
|
+
line 13
|
|
21
|
+
line 14
|
|
22
|
+
line 15
|
|
23
|
+
line 16
|
|
24
|
+
line 17
|
|
25
|
+
line 18
|
|
26
|
+
line 19
|
|
27
|
+
line 20
|
|
28
|
+
new: |
|
|
29
|
+
line 1
|
|
30
|
+
line 2
|
|
31
|
+
line 3
|
|
32
|
+
line 4
|
|
33
|
+
line 5
|
|
34
|
+
line 6
|
|
35
|
+
line 7
|
|
36
|
+
line 8
|
|
37
|
+
line 9
|
|
38
|
+
line ten
|
|
39
|
+
line 11
|
|
40
|
+
line 12
|
|
41
|
+
line 13
|
|
42
|
+
line 14
|
|
43
|
+
line 15
|
|
44
|
+
line 16
|
|
45
|
+
line 17
|
|
46
|
+
line 18
|
|
47
|
+
line 19
|
|
48
|
+
line 20
|
|
49
|
+
diff: |
|
|
50
|
+
--- a/src/a.ts
|
|
51
|
+
+++ b/src/a.ts
|
|
52
|
+
@@ -7,7 +7,7 @@
|
|
53
|
+
line 7
|
|
54
|
+
line 8
|
|
55
|
+
line 9
|
|
56
|
+
-line 10
|
|
57
|
+
+line ten
|
|
58
|
+
line 11
|
|
59
|
+
line 12
|
|
60
|
+
line 13
|
|
61
|
+
- name: distant changes make two hunks
|
|
62
|
+
path: src/a.ts
|
|
63
|
+
old: |
|
|
64
|
+
line 1
|
|
65
|
+
line 2
|
|
66
|
+
line 3
|
|
67
|
+
line 4
|
|
68
|
+
line 5
|
|
69
|
+
line 6
|
|
70
|
+
line 7
|
|
71
|
+
line 8
|
|
72
|
+
line 9
|
|
73
|
+
line 10
|
|
74
|
+
line 11
|
|
75
|
+
line 12
|
|
76
|
+
line 13
|
|
77
|
+
line 14
|
|
78
|
+
line 15
|
|
79
|
+
line 16
|
|
80
|
+
line 17
|
|
81
|
+
line 18
|
|
82
|
+
line 19
|
|
83
|
+
line 20
|
|
84
|
+
new: |
|
|
85
|
+
line 1
|
|
86
|
+
line two
|
|
87
|
+
line 3
|
|
88
|
+
line 4
|
|
89
|
+
line 5
|
|
90
|
+
line 6
|
|
91
|
+
line 7
|
|
92
|
+
line 8
|
|
93
|
+
line 9
|
|
94
|
+
line 10
|
|
95
|
+
line 11
|
|
96
|
+
line 12
|
|
97
|
+
line 13
|
|
98
|
+
line 14
|
|
99
|
+
line 15
|
|
100
|
+
line 16
|
|
101
|
+
line 17
|
|
102
|
+
line eighteen
|
|
103
|
+
line 19
|
|
104
|
+
line 20
|
|
105
|
+
diff: |
|
|
106
|
+
--- a/src/a.ts
|
|
107
|
+
+++ b/src/a.ts
|
|
108
|
+
@@ -1,5 +1,5 @@
|
|
109
|
+
line 1
|
|
110
|
+
-line 2
|
|
111
|
+
+line two
|
|
112
|
+
line 3
|
|
113
|
+
line 4
|
|
114
|
+
line 5
|
|
115
|
+
@@ -15,6 +15,6 @@
|
|
116
|
+
line 15
|
|
117
|
+
line 16
|
|
118
|
+
line 17
|
|
119
|
+
-line 18
|
|
120
|
+
+line eighteen
|
|
121
|
+
line 19
|
|
122
|
+
line 20
|
|
123
|
+
- name: nearby changes share one hunk
|
|
124
|
+
path: src/a.ts
|
|
125
|
+
old: |
|
|
126
|
+
line 1
|
|
127
|
+
line 2
|
|
128
|
+
line 3
|
|
129
|
+
line 4
|
|
130
|
+
line 5
|
|
131
|
+
line 6
|
|
132
|
+
line 7
|
|
133
|
+
line 8
|
|
134
|
+
line 9
|
|
135
|
+
line 10
|
|
136
|
+
line 11
|
|
137
|
+
line 12
|
|
138
|
+
line 13
|
|
139
|
+
line 14
|
|
140
|
+
line 15
|
|
141
|
+
line 16
|
|
142
|
+
line 17
|
|
143
|
+
line 18
|
|
144
|
+
line 19
|
|
145
|
+
line 20
|
|
146
|
+
new: |
|
|
147
|
+
line 1
|
|
148
|
+
line 2
|
|
149
|
+
line 3
|
|
150
|
+
line 4
|
|
151
|
+
line five
|
|
152
|
+
line 6
|
|
153
|
+
line 7
|
|
154
|
+
line 8
|
|
155
|
+
line 9
|
|
156
|
+
line 10
|
|
157
|
+
line eleven
|
|
158
|
+
line 12
|
|
159
|
+
line 13
|
|
160
|
+
line 14
|
|
161
|
+
line 15
|
|
162
|
+
line 16
|
|
163
|
+
line 17
|
|
164
|
+
line 18
|
|
165
|
+
line 19
|
|
166
|
+
line 20
|
|
167
|
+
diff: |
|
|
168
|
+
--- a/src/a.ts
|
|
169
|
+
+++ b/src/a.ts
|
|
170
|
+
@@ -2,13 +2,13 @@
|
|
171
|
+
line 2
|
|
172
|
+
line 3
|
|
173
|
+
line 4
|
|
174
|
+
-line 5
|
|
175
|
+
+line five
|
|
176
|
+
line 6
|
|
177
|
+
line 7
|
|
178
|
+
line 8
|
|
179
|
+
line 9
|
|
180
|
+
line 10
|
|
181
|
+
-line 11
|
|
182
|
+
+line eleven
|
|
183
|
+
line 12
|
|
184
|
+
line 13
|
|
185
|
+
line 14
|
|
186
|
+
- name: insertion at the start
|
|
187
|
+
path: src/a.ts
|
|
188
|
+
old: |
|
|
189
|
+
b
|
|
190
|
+
c
|
|
191
|
+
new: |
|
|
192
|
+
a
|
|
193
|
+
b
|
|
194
|
+
c
|
|
195
|
+
diff: |
|
|
196
|
+
--- a/src/a.ts
|
|
197
|
+
+++ b/src/a.ts
|
|
198
|
+
@@ -1,2 +1,3 @@
|
|
199
|
+
+a
|
|
200
|
+
b
|
|
201
|
+
c
|
|
202
|
+
- name: no final newline on either side
|
|
203
|
+
path: src/a.ts
|
|
204
|
+
old: |-
|
|
205
|
+
a
|
|
206
|
+
b
|
|
207
|
+
new: |-
|
|
208
|
+
a
|
|
209
|
+
c
|
|
210
|
+
diff: |-
|
|
211
|
+
--- a/src/a.ts
|
|
212
|
+
+++ b/src/a.ts
|
|
213
|
+
@@ -1,2 +1,2 @@
|
|
214
|
+
a
|
|
215
|
+
-b+c
|
|
216
|
+
- name: final newline added
|
|
217
|
+
path: src/a.ts
|
|
218
|
+
old: |-
|
|
219
|
+
a
|
|
220
|
+
b
|
|
221
|
+
new: |
|
|
222
|
+
a
|
|
223
|
+
b
|
|
224
|
+
diff: |
|
|
225
|
+
--- a/src/a.ts
|
|
226
|
+
+++ b/src/a.ts
|
|
227
|
+
@@ -1,2 +1,2 @@
|
|
228
|
+
a
|
|
229
|
+
-b+b
|
|
230
|
+
- name: CRLF line endings
|
|
231
|
+
path: src/a.ts
|
|
232
|
+
old: "a\r\nb\r\nc\r\n"
|
|
233
|
+
new: "a\r\nB\r\nc\r\n"
|
|
234
|
+
diff: "--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1,3 +1,3 @@\n a\r\n-b\r\n+B\r\n c\r\n"
|
|
235
|
+
- name: lone CR and U+2028 end lines as Python's splitlines does
|
|
236
|
+
path: src/a.ts
|
|
237
|
+
old: "a\rb\u2028c\n"
|
|
238
|
+
new: "a\rB\u2028c\n"
|
|
239
|
+
diff: "--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1,3 +1,3 @@\n a\r-b\u2028+B\u2028 c\n"
|
|
240
|
+
- name: created file
|
|
241
|
+
path: src/new.ts
|
|
242
|
+
old: ''
|
|
243
|
+
new: |
|
|
244
|
+
export const a = 1;
|
|
245
|
+
export const b = 2;
|
|
246
|
+
diff: |
|
|
247
|
+
--- a/src/new.ts
|
|
248
|
+
+++ b/src/new.ts
|
|
249
|
+
@@ -0,0 +1,2 @@
|
|
250
|
+
+export const a = 1;
|
|
251
|
+
+export const b = 2;
|
|
252
|
+
- name: deleted file
|
|
253
|
+
path: src/old.ts
|
|
254
|
+
old: |
|
|
255
|
+
export const a = 1;
|
|
256
|
+
export const b = 2;
|
|
257
|
+
new: ''
|
|
258
|
+
diff: |
|
|
259
|
+
--- a/src/old.ts
|
|
260
|
+
+++ b/src/old.ts
|
|
261
|
+
@@ -1,2 +0,0 @@
|
|
262
|
+
-export const a = 1;
|
|
263
|
+
-export const b = 2;
|
|
264
|
+
- name: path with spaces
|
|
265
|
+
path: src/my file.ts
|
|
266
|
+
old: |
|
|
267
|
+
a
|
|
268
|
+
new: |
|
|
269
|
+
b
|
|
270
|
+
diff: |
|
|
271
|
+
--- a/src/my file.ts
|
|
272
|
+
+++ b/src/my file.ts
|
|
273
|
+
@@ -1 +1 @@
|
|
274
|
+
-a
|
|
275
|
+
+b
|
|
276
|
+
- name: non-ASCII path and text
|
|
277
|
+
path: src/naïve/ü.ts
|
|
278
|
+
old: |
|
|
279
|
+
const s = 'ä';
|
|
280
|
+
new: |
|
|
281
|
+
const s = 'ö';
|
|
282
|
+
diff: |
|
|
283
|
+
--- a/src/naïve/ü.ts
|
|
284
|
+
+++ b/src/naïve/ü.ts
|
|
285
|
+
@@ -1 +1 @@
|
|
286
|
+
-const s = 'ä';
|
|
287
|
+
+const s = 'ö';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# The repo format (`format` in living-architecture.yaml): which values are versions, how versions compare, and
|
|
2
|
+
# how la-arch-migrate stamps the current format into a config text.
|
|
3
|
+
# `valid` and `invalid` values are read with the shared YAML profile. `compare` is [a, b, sign of a - b], compared
|
|
4
|
+
# component by component as integers of any size. `stamp` maps a config `text` to its `stamped` text, `<FORMAT>`
|
|
5
|
+
# standing for the current format: inserted when `text` declares no format, else replacing the declared value;
|
|
6
|
+
# `stamped: null` means the format must be set by hand.
|
|
7
|
+
valid:
|
|
8
|
+
- '0.4.0'
|
|
9
|
+
- '0.0.0'
|
|
10
|
+
- '10.20.30'
|
|
11
|
+
- '99999999999999999999.0.0'
|
|
12
|
+
invalid:
|
|
13
|
+
- '0.4'
|
|
14
|
+
- '0.4.0.0'
|
|
15
|
+
- 'v0.4.0'
|
|
16
|
+
- '0.04.0'
|
|
17
|
+
- '00.4.0'
|
|
18
|
+
- '-1.0.0'
|
|
19
|
+
- '+1.0.0'
|
|
20
|
+
- '1.0.0-rc1'
|
|
21
|
+
- ' 0.4.0'
|
|
22
|
+
- '0.4.0 '
|
|
23
|
+
- "0.4.0\n"
|
|
24
|
+
- '0..0'
|
|
25
|
+
- '0.4.'
|
|
26
|
+
- ''
|
|
27
|
+
- '١.٠.٠'
|
|
28
|
+
- '1.0.0'
|
|
29
|
+
- '1٠.0.0'
|
|
30
|
+
- '0.11.0'
|
|
31
|
+
- 0.4
|
|
32
|
+
- 400
|
|
33
|
+
- true
|
|
34
|
+
- null
|
|
35
|
+
- [0, 4, 0]
|
|
36
|
+
- {major: 0}
|
|
37
|
+
compare:
|
|
38
|
+
- ['0.4.0', '0.4.0', 0]
|
|
39
|
+
- ['0.3.0', '0.4.0', -1]
|
|
40
|
+
- ['0.4.0', '0.3.9', 1]
|
|
41
|
+
- ['0.10.0', '0.9.0', 1]
|
|
42
|
+
- ['0.4.10', '0.4.9', 1]
|
|
43
|
+
- ['1.0.0', '0.99.99', 1]
|
|
44
|
+
- ['9.0.0', '10.0.0', -1]
|
|
45
|
+
- ['9007199254740993.0.0', '9007199254740992.0.0', 1]
|
|
46
|
+
- ['99999999999999999999.0.0', '99999999999999999998.0.0', 1]
|
|
47
|
+
- ['99999999999999999999.0.0', '100000000000000000000.0.0', -1]
|
|
48
|
+
- ['0.0.99999999999999999999', '0.1.0', -1]
|
|
49
|
+
stamp:
|
|
50
|
+
- name: block mapping
|
|
51
|
+
text: "tracker: linear\n"
|
|
52
|
+
stamped: "format: <FORMAT>\ntracker: linear\n"
|
|
53
|
+
- name: leading comments and blank lines
|
|
54
|
+
text: "# a\n # b\n\ntracker: linear\nopenspec: false\n"
|
|
55
|
+
stamped: "# a\n # b\n\nformat: <FORMAT>\ntracker: linear\nopenspec: false\n"
|
|
56
|
+
- name: whitespace-only line counts as blank
|
|
57
|
+
text: "# a\n \ntracker: linear\n"
|
|
58
|
+
stamped: "# a\n \nformat: <FORMAT>\ntracker: linear\n"
|
|
59
|
+
- name: directive and document marker
|
|
60
|
+
text: "%YAML 1.1\n---\ntracker: linear\n"
|
|
61
|
+
stamped: "%YAML 1.1\n---\nformat: <FORMAT>\ntracker: linear\n"
|
|
62
|
+
- name: document marker alone
|
|
63
|
+
text: "---\ntracker: linear\n"
|
|
64
|
+
stamped: "---\nformat: <FORMAT>\ntracker: linear\n"
|
|
65
|
+
- name: no final line break after the keys
|
|
66
|
+
text: "tracker: linear"
|
|
67
|
+
stamped: "format: <FORMAT>\ntracker: linear"
|
|
68
|
+
- name: removed key kept
|
|
69
|
+
text: "reviewers: {coderabbit: true}\n"
|
|
70
|
+
stamped: "format: <FORMAT>\nreviewers: {coderabbit: true}\n"
|
|
71
|
+
- name: crlf
|
|
72
|
+
text: "# a\r\ntracker: linear\r\nopenspec: false\r\n"
|
|
73
|
+
stamped: "# a\r\nformat: <FORMAT>\r\ntracker: linear\r\nopenspec: false\r\n"
|
|
74
|
+
- name: crlf comment-only without final line break
|
|
75
|
+
text: "# a\r\n# b"
|
|
76
|
+
stamped: "# a\r\n# b\r\nformat: <FORMAT>\r\n"
|
|
77
|
+
- name: empty
|
|
78
|
+
text: ""
|
|
79
|
+
stamped: "format: <FORMAT>\n"
|
|
80
|
+
- name: blank lines only
|
|
81
|
+
text: "\n\n"
|
|
82
|
+
stamped: "\n\nformat: <FORMAT>\n"
|
|
83
|
+
- name: comment-only without final line break
|
|
84
|
+
text: "# nothing yet"
|
|
85
|
+
stamped: "# nothing yet\nformat: <FORMAT>\n"
|
|
86
|
+
- name: comment-only with final line break
|
|
87
|
+
text: "# nothing yet\n"
|
|
88
|
+
stamped: "# nothing yet\nformat: <FORMAT>\n"
|
|
89
|
+
- name: flow mapping
|
|
90
|
+
text: "{tracker: linear}\n"
|
|
91
|
+
stamped: null
|
|
92
|
+
- name: indented top-level mapping
|
|
93
|
+
text: " tracker: linear\n"
|
|
94
|
+
stamped: null
|
|
95
|
+
- name: top-level list
|
|
96
|
+
text: "- tracker\n"
|
|
97
|
+
stamped: null
|
|
98
|
+
- name: top-level scalar
|
|
99
|
+
text: "42\n"
|
|
100
|
+
stamped: null
|
|
101
|
+
- name: replace the first key
|
|
102
|
+
text: "format: 0.3.0\ntracker: linear\n"
|
|
103
|
+
stamped: "format: <FORMAT>\ntracker: linear\n"
|
|
104
|
+
- name: replace a later key
|
|
105
|
+
text: "tracker: linear\nformat: 0.3.0\nopenspec: false\n"
|
|
106
|
+
stamped: "tracker: linear\nformat: <FORMAT>\nopenspec: false\n"
|
|
107
|
+
- name: replace a single-quoted value
|
|
108
|
+
text: "format: '0.3.0'\n"
|
|
109
|
+
stamped: "format: <FORMAT>\n"
|
|
110
|
+
- name: replace a double-quoted value
|
|
111
|
+
text: "format: \"0.3.0\"\n"
|
|
112
|
+
stamped: "format: <FORMAT>\n"
|
|
113
|
+
- name: replace keeps extra spaces after the colon
|
|
114
|
+
text: "format: 0.3.0\n"
|
|
115
|
+
stamped: "format: <FORMAT>\n"
|
|
116
|
+
- name: replace keeps the trailing comment
|
|
117
|
+
text: "tracker: linear\nformat: '0.3.0' # repo format\n"
|
|
118
|
+
stamped: "tracker: linear\nformat: <FORMAT> # repo format\n"
|
|
119
|
+
- name: replace a quoted value containing a hash
|
|
120
|
+
text: "format: 'a # b' # c\n"
|
|
121
|
+
stamped: "format: <FORMAT> # c\n"
|
|
122
|
+
- name: replace an invalid version
|
|
123
|
+
text: "format: 0.4\n"
|
|
124
|
+
stamped: "format: <FORMAT>\n"
|
|
125
|
+
- name: replace without a final line break
|
|
126
|
+
text: "tracker: linear\nformat: 0.3.0"
|
|
127
|
+
stamped: "tracker: linear\nformat: <FORMAT>"
|
|
128
|
+
- name: replace with crlf
|
|
129
|
+
text: "format: 0.3.0\r\ntracker: linear\r\n"
|
|
130
|
+
stamped: "format: <FORMAT>\r\ntracker: linear\r\n"
|
|
131
|
+
- name: replace after leading comments and a document marker
|
|
132
|
+
text: "# a\n---\nformat: 0.3.0\n"
|
|
133
|
+
stamped: "# a\n---\nformat: <FORMAT>\n"
|
|
134
|
+
- name: replace a tab after the colon
|
|
135
|
+
text: "format:\t0.3.0\n"
|
|
136
|
+
stamped: null
|
|
137
|
+
- name: replace a value on the next line
|
|
138
|
+
text: "format:\n 0.3.0\n"
|
|
139
|
+
stamped: null
|
|
140
|
+
- name: replace a block scalar
|
|
141
|
+
text: "format: |\n 0.3.0\n"
|
|
142
|
+
stamped: null
|
|
143
|
+
- name: replace a flow mapping value
|
|
144
|
+
text: "format: {major: 0}\n"
|
|
145
|
+
stamped: null
|
|
146
|
+
- name: replace a flow sequence value
|
|
147
|
+
text: "format: [0, 3, 0]\n"
|
|
148
|
+
stamped: null
|
|
149
|
+
- name: replace inside a flow mapping
|
|
150
|
+
text: "{format: 0.3.0}\n"
|
|
151
|
+
stamped: null
|
|
152
|
+
- name: replace a spaced key
|
|
153
|
+
text: "format : 0.3.0\n"
|
|
154
|
+
stamped: null
|
|
155
|
+
- name: replace a quoted key
|
|
156
|
+
text: "'format': 0.3.0\n"
|
|
157
|
+
stamped: null
|
|
158
|
+
- name: replace two format lines
|
|
159
|
+
text: "format: 0.3.0\ntracker: linear\nformat: 0.3.0\n"
|
|
160
|
+
stamped: null
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# The contract glob dialect, matched against a POSIX repo-relative path:
|
|
2
|
+
# case-sensitive; `*` matches within one segment (dots are not special);
|
|
3
|
+
# `**` as a whole segment matches zero or more segments; every other character is literal.
|
|
4
|
+
cases:
|
|
5
|
+
- pattern: '*.py'
|
|
6
|
+
path: a.py
|
|
7
|
+
match: true
|
|
8
|
+
- pattern: '*.py'
|
|
9
|
+
path: dir/a.py
|
|
10
|
+
match: false
|
|
11
|
+
- pattern: '*.py'
|
|
12
|
+
path: .hidden.py
|
|
13
|
+
match: true
|
|
14
|
+
- pattern: '*.py'
|
|
15
|
+
path: a.pyc
|
|
16
|
+
match: false
|
|
17
|
+
- pattern: '*'
|
|
18
|
+
path: a
|
|
19
|
+
match: true
|
|
20
|
+
- pattern: '*'
|
|
21
|
+
path: a/b
|
|
22
|
+
match: false
|
|
23
|
+
- pattern: '*'
|
|
24
|
+
path: ''
|
|
25
|
+
match: false
|
|
26
|
+
- pattern: '**'
|
|
27
|
+
path: a
|
|
28
|
+
match: true
|
|
29
|
+
- pattern: '**'
|
|
30
|
+
path: a/b/c
|
|
31
|
+
match: true
|
|
32
|
+
- pattern: '**/*.py'
|
|
33
|
+
path: a.py
|
|
34
|
+
match: true
|
|
35
|
+
- pattern: '**/*.py'
|
|
36
|
+
path: a/b/c.py
|
|
37
|
+
match: true
|
|
38
|
+
- pattern: '**/*.py'
|
|
39
|
+
path: a/b/c.txt
|
|
40
|
+
match: false
|
|
41
|
+
- pattern: '**/tests/**'
|
|
42
|
+
path: tests
|
|
43
|
+
match: true
|
|
44
|
+
- pattern: '**/tests/**'
|
|
45
|
+
path: tests/x.py
|
|
46
|
+
match: true
|
|
47
|
+
- pattern: '**/tests/**'
|
|
48
|
+
path: a/tests/b/c.py
|
|
49
|
+
match: true
|
|
50
|
+
- pattern: '**/tests/**'
|
|
51
|
+
path: a/xtests/b.py
|
|
52
|
+
match: false
|
|
53
|
+
- pattern: '**/tests/**'
|
|
54
|
+
path: .venv/tests/x.py
|
|
55
|
+
match: true
|
|
56
|
+
- pattern: '**/tests/**/*'
|
|
57
|
+
path: tests
|
|
58
|
+
match: false
|
|
59
|
+
- pattern: '**/tests/**/*'
|
|
60
|
+
path: tests/x.py
|
|
61
|
+
match: true
|
|
62
|
+
- pattern: '**/tests/**/*'
|
|
63
|
+
path: src/tests
|
|
64
|
+
match: false
|
|
65
|
+
- pattern: a/*/c
|
|
66
|
+
path: a/b/c
|
|
67
|
+
match: true
|
|
68
|
+
- pattern: a/*/c
|
|
69
|
+
path: a/b/d/c
|
|
70
|
+
match: false
|
|
71
|
+
- pattern: a/*/c
|
|
72
|
+
path: a/c
|
|
73
|
+
match: false
|
|
74
|
+
- pattern: a/**/c
|
|
75
|
+
path: a/c
|
|
76
|
+
match: true
|
|
77
|
+
- pattern: a/**/c
|
|
78
|
+
path: a/b/d/c
|
|
79
|
+
match: true
|
|
80
|
+
- pattern: a/**/c
|
|
81
|
+
path: ab/c
|
|
82
|
+
match: false
|
|
83
|
+
- pattern: gen/*
|
|
84
|
+
path: gen/x.py
|
|
85
|
+
match: true
|
|
86
|
+
- pattern: gen/*
|
|
87
|
+
path: gen/sub/x.py
|
|
88
|
+
match: false
|
|
89
|
+
- pattern: gen/**
|
|
90
|
+
path: gen/sub/x.py
|
|
91
|
+
match: true
|
|
92
|
+
- pattern: '*.PY'
|
|
93
|
+
path: a.py
|
|
94
|
+
match: false
|
|
95
|
+
- pattern: Tests/*
|
|
96
|
+
path: tests/x
|
|
97
|
+
match: false
|
|
98
|
+
- pattern: tests/*
|
|
99
|
+
path: Tests/x
|
|
100
|
+
match: false
|
|
101
|
+
- pattern: test_*
|
|
102
|
+
path: test_x.py
|
|
103
|
+
match: true
|
|
104
|
+
- pattern: test_*
|
|
105
|
+
path: atest_x.py
|
|
106
|
+
match: false
|
|
107
|
+
- pattern: test_*
|
|
108
|
+
path: test_
|
|
109
|
+
match: true
|
|
110
|
+
- pattern: '**/test_*'
|
|
111
|
+
path: a/b/test_x.py
|
|
112
|
+
match: true
|
|
113
|
+
- pattern: '**/test_*'
|
|
114
|
+
path: test_dir/x.py
|
|
115
|
+
match: false
|
|
116
|
+
- pattern: '**/*_test.py'
|
|
117
|
+
path: pkg/x_test.py
|
|
118
|
+
match: true
|
|
119
|
+
- pattern: '**/*_test.py'
|
|
120
|
+
path: x_test.pyc
|
|
121
|
+
match: false
|
|
122
|
+
- pattern: '**/conftest.py'
|
|
123
|
+
path: conftest.py
|
|
124
|
+
match: true
|
|
125
|
+
- pattern: '**/conftest.py'
|
|
126
|
+
path: a/conftest.py
|
|
127
|
+
match: true
|
|
128
|
+
- pattern: '**/conftest.py'
|
|
129
|
+
path: a/myconftest.py
|
|
130
|
+
match: false
|
|
131
|
+
- pattern: a?.py
|
|
132
|
+
path: ab.py
|
|
133
|
+
match: false
|
|
134
|
+
- pattern: a?.py
|
|
135
|
+
path: a?.py
|
|
136
|
+
match: true
|
|
137
|
+
- pattern: '[ab].py'
|
|
138
|
+
path: a.py
|
|
139
|
+
match: false
|
|
140
|
+
- pattern: '[ab].py'
|
|
141
|
+
path: '[ab].py'
|
|
142
|
+
match: true
|
|
143
|
+
- pattern: .*
|
|
144
|
+
path: .git
|
|
145
|
+
match: true
|
|
146
|
+
- pattern: '**/.cache/**'
|
|
147
|
+
path: x/.cache/y
|
|
148
|
+
match: true
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Default materialization against small schemas: absent properties with a `default`, and absent objects whose
|
|
2
|
+
# sub-schema has defaulted properties, are created; explicit values (including false, 0, [], "" and null) are
|
|
3
|
+
# never replaced.
|
|
4
|
+
cases:
|
|
5
|
+
- name: explicit zero kept
|
|
6
|
+
schema: {type: object, properties: {n: {type: integer, default: 5}}}
|
|
7
|
+
input: {n: 0}
|
|
8
|
+
output: {n: 0}
|
|
9
|
+
- name: explicit false, empty list, empty string and null kept
|
|
10
|
+
schema:
|
|
11
|
+
type: object
|
|
12
|
+
properties:
|
|
13
|
+
b: {type: boolean, default: true}
|
|
14
|
+
l: {type: array, default: [x]}
|
|
15
|
+
s: {type: string, default: d}
|
|
16
|
+
z: {type: [string, "null"], default: d}
|
|
17
|
+
input: {b: false, l: [], s: "", z: null}
|
|
18
|
+
output: {b: false, l: [], s: "", z: null}
|
|
19
|
+
- name: absent property gets its default
|
|
20
|
+
schema: {type: object, properties: {n: {type: integer, default: 5}, m: {type: integer}}}
|
|
21
|
+
input: {}
|
|
22
|
+
output: {n: 5}
|
|
23
|
+
- name: absent parent created from defaulted children
|
|
24
|
+
schema:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
outer:
|
|
28
|
+
type: object
|
|
29
|
+
properties:
|
|
30
|
+
inner: {type: object, properties: {flag: {type: boolean, default: false}}}
|
|
31
|
+
count: {type: integer, default: 1}
|
|
32
|
+
input: {}
|
|
33
|
+
output: {outer: {inner: {flag: false}, count: 1}}
|
|
34
|
+
- name: present parent completed
|
|
35
|
+
schema:
|
|
36
|
+
type: object
|
|
37
|
+
properties:
|
|
38
|
+
outer: {type: object, properties: {a: {type: integer, default: 1}, b: {type: integer, default: 2}}}
|
|
39
|
+
input: {outer: {b: 7}}
|
|
40
|
+
output: {outer: {a: 1, b: 7}}
|
|
41
|
+
- name: object default not merged into an explicit object
|
|
42
|
+
schema:
|
|
43
|
+
type: object
|
|
44
|
+
properties:
|
|
45
|
+
o: {type: object, default: {a: 1}, properties: {a: {type: integer}, c: {type: integer}}}
|
|
46
|
+
input: {o: {c: 3}}
|
|
47
|
+
output: {o: {c: 3}}
|
|
48
|
+
- name: missing document is an empty object
|
|
49
|
+
schema: {type: object, properties: {n: {type: integer, default: 5}}}
|
|
50
|
+
input: null
|
|
51
|
+
output: {n: 5}
|