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);
@@ -319,18 +319,22 @@ content: "\n// infostrings cannot have leading dots\n\nfn main() {}\n"
319
319
320
320
#[test]
321
321
fnrustc_dot_in_infostring_non_leading(){
322
-
assert_err(
323
-
ScriptSource::parse(
324
-
r#"---Cargo.toml
322
+
assert_source(
323
+
r#"---Cargo.toml
325
324
---
326
325
327
326
// infostrings can contain dots as long as a dot isn't the first character.
328
327
//@ check-pass
329
328
330
329
fn main() {}
331
330
"#,
332
-
),
333
-
str!["no closing `---` found for frontmatter"],
331
+
str![[r#"
332
+
shebang: None
333
+
info: "Cargo.toml"
334
+
frontmatter: ""
335
+
content: "\n// infostrings can contain dots as long as a dot isn't the first character.\n//@ check-pass\n\nfn main() {}\n"
336
+
337
+
"#]],
334
338
);
335
339
}
336
340
@@ -371,7 +375,7 @@ content: "\n//@ check-pass\n\n// This test checks that longer dashes for opening
371
375
fn main() {}
372
376
"#,
373
377
),
374
-
str!["no closing `---` found for frontmatter"],
378
+
str!["trailing characters found after frontmatter close"],
375
379
);
376
380
}
377
381
@@ -470,9 +474,8 @@ fn foo(x: i32) -> i32 {
470
474
471
475
#[test]
472
476
fnrustc_frontmatter_whitespace_3(){
473
-
assert_err(
474
-
ScriptSource::parse(
475
-
r#"
477
+
assert_source(
478
+
r#"
476
479
477
480
478
481
---cargo
@@ -488,25 +491,34 @@ fn foo(x: i32) -> i32 {
488
491
489
492
fn main() {}
490
493
"#,
491
-
),
492
-
str!["no closing `---` found for frontmatter"],
494
+
str![[r#"
495
+
shebang: None
496
+
info: "cargo"
497
+
frontmatter: ""
498
+
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"
499
+
500
+
"#]],
493
501
);
494
502
}
495
503
496
504
#[test]
497
505
fnrustc_frontmatter_whitespace_4(){
498
-
assert_err(
499
-
ScriptSource::parse(
500
-
r#"--- cargo
506
+
assert_source(
507
+
r#"--- cargo
501
508
---
502
509
503
510
//@ check-pass
504
511
// A frontmatter infostring can have leading whitespace.
505
512
506
513
fn main() {}
507
514
"#,
508
-
),
509
-
str!["no closing `---` found for frontmatter"],
515
+
str![[r#"
516
+
shebang: None
517
+
info: "cargo"
518
+
frontmatter: ""
519
+
content: "\n//@ check-pass\n// A frontmatter infostring can have leading whitespace.\n\nfn main() {}\n"
520
+
521
+
"#]],
510
522
);
511
523
}
512
524
@@ -609,8 +621,8 @@ fn main() {}
609
621
str![[r#"
610
622
shebang: None
611
623
info: None
612
-
frontmatter: "---\n\n"
613
-
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"
624
+
frontmatter: ""
625
+
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