Skip to content

Commit b0c01ba

Browse files
committed
Update old tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 45f08c9 commit b0c01ba

File tree

3 files changed

+58
-8
lines changed

3 files changed

+58
-8
lines changed

tests/testsuite/build.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,14 @@ fn cargo_compile_with_filename() {
10411041

10421042
p.cargo("build --bin bin.rs")
10431043
.with_status(101)
1044-
.with_stderr("[ERROR] no bin target named `bin.rs`")
1044+
.with_stderr(
1045+
"\
1046+
[ERROR] no bin target named `bin.rs`.
1047+
Available bin targets:
1048+
a
1049+
1050+
",
1051+
)
10451052
.run();
10461053

10471054
p.cargo("build --bin a.rs")
@@ -1056,7 +1063,14 @@ fn cargo_compile_with_filename() {
10561063

10571064
p.cargo("build --example example.rs")
10581065
.with_status(101)
1059-
.with_stderr("[ERROR] no example target named `example.rs`")
1066+
.with_stderr(
1067+
"\
1068+
[ERROR] no example target named `example.rs`.
1069+
Available example targets:
1070+
a
1071+
1072+
",
1073+
)
10601074
.run();
10611075

10621076
p.cargo("build --example a.rs")

tests/testsuite/run.rs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,10 @@ automatically infer them to be a target, such as in subfolders.
503503
504504
For more information on this warning you can consult
505505
https://github.com/rust-lang/cargo/issues/5330
506-
error: no example target named `a`
506+
error: no example target named `a`.
507+
Available example targets:
508+
do_magic
509+
507510
",
508511
)
509512
.run();
@@ -528,7 +531,14 @@ fn run_example_autodiscover_2015_with_autoexamples_disabled() {
528531
let p = autodiscover_examples_project("2015", Some(false));
529532
p.cargo("run --example a")
530533
.with_status(101)
531-
.with_stderr("error: no example target named `a`\n")
534+
.with_stderr(
535+
"\
536+
error: no example target named `a`.
537+
Available example targets:
538+
do_magic
539+
540+
",
541+
)
532542
.run();
533543
}
534544

@@ -600,7 +610,14 @@ fn run_with_filename() {
600610

601611
p.cargo("run --bin bin.rs")
602612
.with_status(101)
603-
.with_stderr("[ERROR] no bin target named `bin.rs`")
613+
.with_stderr(
614+
"\
615+
[ERROR] no bin target named `bin.rs`.
616+
Available bin targets:
617+
a
618+
619+
",
620+
)
604621
.run();
605622

606623
p.cargo("run --bin a.rs")
@@ -615,7 +632,14 @@ fn run_with_filename() {
615632

616633
p.cargo("run --example example.rs")
617634
.with_status(101)
618-
.with_stderr("[ERROR] no example target named `example.rs`")
635+
.with_stderr(
636+
"\
637+
[ERROR] no example target named `example.rs`.
638+
Available example targets:
639+
a
640+
641+
",
642+
)
619643
.run();
620644

621645
p.cargo("run --example a.rs")

tests/testsuite/test.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,11 +2122,23 @@ fn bad_example() {
21222122

21232123
p.cargo("run --example foo")
21242124
.with_status(101)
2125-
.with_stderr("[ERROR] no example target named `foo`")
2125+
.with_stderr(
2126+
"\
2127+
[ERROR] no example target named `foo`.
2128+
No example targets available.
2129+
2130+
",
2131+
)
21262132
.run();
21272133
p.cargo("run --bin foo")
21282134
.with_status(101)
2129-
.with_stderr("[ERROR] no bin target named `foo`")
2135+
.with_stderr(
2136+
"\
2137+
[ERROR] no bin target named `foo`.
2138+
No bin targets available.
2139+
2140+
",
2141+
)
21302142
.run();
21312143
}
21322144

0 commit comments

Comments
 (0)