You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let after_closing_fence = after_closing_fence.trim_matches(WHITESPACE);
@@ -251,18 +251,22 @@ content: "\n// infostrings cannot have leading dots\n\nfn main() {}\n"
251
251
252
252
#[test]
253
253
fnrustc_dot_in_infostring_non_leading(){
254
-
assert_err(
255
-
ScriptSource::parse(
256
-
r#"---Cargo.toml
254
+
assert_source(
255
+
r#"---Cargo.toml
257
256
---
258
257
259
258
// infostrings can contain dots as long as a dot isn't the first character.
260
259
//@ check-pass
261
260
262
261
fn main() {}
263
262
"#,
264
-
),
265
-
str!["no closing `---` found for frontmatter"],
263
+
str![[r#"
264
+
shebang: None
265
+
info: "Cargo.toml"
266
+
frontmatter: ""
267
+
content: "\n// infostrings can contain dots as long as a dot isn't the first character.\n//@ check-pass\n\nfn main() {}\n"
268
+
269
+
"#]],
266
270
);
267
271
}
268
272
@@ -303,7 +307,7 @@ content: "\n//@ check-pass\n\n// This test checks that longer dashes for opening
303
307
fn main() {}
304
308
"#,
305
309
),
306
-
str!["no closing `---` found for frontmatter"],
310
+
str!["trailing characters found after frontmatter close"],
307
311
);
308
312
}
309
313
@@ -402,9 +406,8 @@ fn foo(x: i32) -> i32 {
402
406
403
407
#[test]
404
408
fnrustc_frontmatter_whitespace_3(){
405
-
assert_err(
406
-
ScriptSource::parse(
407
-
r#"
409
+
assert_source(
410
+
r#"
408
411
409
412
410
413
---cargo
@@ -420,25 +423,34 @@ fn foo(x: i32) -> i32 {
420
423
421
424
fn main() {}
422
425
"#,
423
-
),
424
-
str!["no closing `---` found for frontmatter"],
426
+
str![[r#"
427
+
shebang: None
428
+
info: "cargo"
429
+
frontmatter: ""
430
+
content: "\n// please note the whitespace characters after the first four lines.\n// This ensures that we accept whitespaces before the frontmatter, after\n// the frontmatter opening and the frontmatter close.\n\n//@ check-pass\n// ignore-tidy-end-whitespace\n// ignore-tidy-leading-newlines\n\nfn main() {}\n"
431
+
432
+
"#]],
425
433
);
426
434
}
427
435
428
436
#[test]
429
437
fnrustc_frontmatter_whitespace_4(){
430
-
assert_err(
431
-
ScriptSource::parse(
432
-
r#"--- cargo
438
+
assert_source(
439
+
r#"--- cargo
433
440
---
434
441
435
442
//@ check-pass
436
443
// A frontmatter infostring can have leading whitespace.
437
444
438
445
fn main() {}
439
446
"#,
440
-
),
441
-
str!["no closing `---` found for frontmatter"],
447
+
str![[r#"
448
+
shebang: None
449
+
info: "cargo"
450
+
frontmatter: ""
451
+
content: "\n//@ check-pass\n// A frontmatter infostring can have leading whitespace.\n\nfn main() {}\n"
452
+
453
+
"#]],
442
454
);
443
455
}
444
456
@@ -541,8 +553,8 @@ fn main() {}
541
553
str![[r#"
542
554
shebang: None
543
555
info: None
544
-
frontmatter: "---\n\n"
545
-
content: "//~^ ERROR: expected item, found `-`\n// FIXME(frontmatter): make this diagnostic better\n---\n\n// test that we do not parse another frontmatter block after the first one.\n\nfn main() {}\n"
556
+
frontmatter: ""
557
+
content: "\n---\n//~^ ERROR: expected item, found `-`\n// FIXME(frontmatter): make this diagnostic better\n---\n\n// test that we do not parse another frontmatter block after the first one.\n\nfn main() {}\n"
0 commit comments