Skip to content

Commit a93d661

Browse files
committed
bless tidy tests
1 parent 4fef9bd commit a93d661

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/tools/tidy/src/alphabetical/tests.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::diagnostics::{TidyCtx, TidyFlags};
77
fn test(lines: &str, name: &str, expected_msg: &str, expected_bad: bool) {
88
let tidy_ctx = TidyCtx::new(Path::new("/"), false, TidyFlags::default());
99
let mut check = tidy_ctx.start_check("alphabetical-test");
10-
check_lines(&name, lines.lines().enumerate(), &mut check);
10+
check_lines(Path::new(name), lines, &tidy_ctx, &mut check);
1111

1212
assert_eq!(expected_bad, check.is_bad());
1313
let errors = check.get_errors();
@@ -95,7 +95,7 @@ fn test_rust_bad() {
9595
def
9696
// tidy-alphabetical-end
9797
";
98-
bad(lines, "bad:4: line not in alphabetical order");
98+
bad(lines, "bad:2: line not in alphabetical order (tip: use --bless to sort this list)");
9999
}
100100

101101
#[test]
@@ -107,7 +107,7 @@ fn test_toml_bad() {
107107
def
108108
# tidy-alphabetical-end
109109
";
110-
bad(lines, "bad:4: line not in alphabetical order");
110+
bad(lines, "bad:2: line not in alphabetical order (tip: use --bless to sort this list)");
111111
}
112112

113113
#[test]
@@ -121,7 +121,7 @@ fn test_features_bad() {
121121
#![feature(def)]
122122
tidy-alphabetical-end
123123
";
124-
bad(lines, "bad:4: line not in alphabetical order");
124+
bad(lines, "bad:2: line not in alphabetical order (tip: use --bless to sort this list)");
125125
}
126126

127127
#[test]
@@ -134,7 +134,7 @@ fn test_indent_bad() {
134134
def
135135
$ tidy-alphabetical-end
136136
";
137-
bad(lines, "bad:4: line not in alphabetical order");
137+
bad(lines, "bad:2: line not in alphabetical order (tip: use --bless to sort this list)");
138138
}
139139

140140
#[test]
@@ -150,7 +150,7 @@ fn test_split_bad() {
150150
)
151151
&& tidy-alphabetical-end
152152
";
153-
bad(lines, "bad:7: line not in alphabetical order");
153+
bad(lines, "bad:3: line not in alphabetical order (tip: use --bless to sort this list)");
154154
}
155155

156156
#[test]
@@ -160,7 +160,7 @@ fn test_double_start() {
160160
abc
161161
tidy-alphabetical-start
162162
";
163-
bad(lines, "bad:3 found `tidy-alphabetical-start` expecting `tidy-alphabetical-end`");
163+
bad(lines, "bad:0 `tidy-alphabetical-start` without a matching `tidy-alphabetical-end`");
164164
}
165165

166166
#[test]
@@ -179,7 +179,7 @@ fn test_missing_end() {
179179
tidy-alphabetical-start
180180
abc
181181
";
182-
bad(lines, "bad: reached end of file expecting `tidy-alphabetical-end`");
182+
bad(lines, "bad:0 `tidy-alphabetical-start` without a matching `tidy-alphabetical-end`");
183183
}
184184

185185
#[test]
@@ -319,23 +319,23 @@ fn test_numeric_bad() {
319319
item2
320320
# tidy-alphabetical-end
321321
";
322-
bad(lines, "bad:4: line not in alphabetical order");
322+
bad(lines, "bad:2: line not in alphabetical order (tip: use --bless to sort this list)");
323323

324324
let lines = "\
325325
# tidy-alphabetical-start
326326
zve64f
327327
zve64d
328328
# tidy-alphabetical-end
329329
";
330-
bad(lines, "bad:3: line not in alphabetical order");
330+
bad(lines, "bad:1: line not in alphabetical order (tip: use --bless to sort this list)");
331331

332332
let lines = "\
333333
# tidy-alphabetical-start
334334
000
335335
00
336336
# tidy-alphabetical-end
337337
";
338-
bad(lines, "bad:3: line not in alphabetical order");
338+
bad(lines, "bad:1: line not in alphabetical order (tip: use --bless to sort this list)");
339339
}
340340

341341
#[test]
@@ -347,7 +347,7 @@ fn multiline() {
347347
(
348348
b,
349349
a
350-
)
350+
);
351351
tidy-alphabetical-end
352352
";
353353
good(lines);
@@ -357,7 +357,7 @@ fn multiline() {
357357
(
358358
b,
359359
a
360-
)
360+
);
361361
(b,
362362
a);
363363
tidy-alphabetical-end
@@ -371,22 +371,22 @@ fn multiline() {
371371
(
372372
b,
373373
a
374-
)
374+
);
375375
tidy-alphabetical-end
376376
";
377-
bad(lines, "bad:5: line not in alphabetical order");
377+
bad(lines, "bad:1: line not in alphabetical order (tip: use --bless to sort this list)");
378378

379379
let lines = "\
380380
tidy-alphabetical-start
381381
(
382382
c,
383383
a
384-
)
384+
);
385385
(b,
386386
a);
387387
tidy-alphabetical-end
388388
";
389-
bad(lines, "bad:6: line not in alphabetical order");
389+
bad(lines, "bad:1: line not in alphabetical order (tip: use --bless to sort this list)");
390390

391391
let lines = "\
392392
force_unwind_tables: Option<bool> = (None, parse_opt_bool, [TRACKED],

0 commit comments

Comments
 (0)