File tree 2 files changed +57
-0
lines changed
2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,8 @@ fn run_doc_tests(
260
260
p. arg ( "--test-args" ) . arg ( "--quiet" ) ;
261
261
}
262
262
263
+ p. args ( unit. pkg . manifest ( ) . lint_rustflags ( ) ) ;
264
+
263
265
p. args ( args) ;
264
266
265
267
if * unstable_opts {
Original file line number Diff line number Diff line change @@ -637,3 +637,58 @@ error: unresolved link to `bar`
637
637
)
638
638
. run ( ) ;
639
639
}
640
+
641
+ #[ cargo_test]
642
+ fn doctest_respects_lints ( ) {
643
+ let foo = project ( )
644
+ . file (
645
+ "Cargo.toml" ,
646
+ r#"
647
+ [package]
648
+ name = "foo"
649
+ version = "0.0.1"
650
+ authors = []
651
+
652
+ [lints.rust]
653
+ confusable-idents = 'allow'
654
+ "# ,
655
+ )
656
+ . file (
657
+ "src/lib.rs" ,
658
+ r#"
659
+ /// Test
660
+ ///
661
+ /// [`Foo`]
662
+ ///
663
+ /// ```
664
+ /// let s = "rust";
665
+ /// let s_s = "rust2";
666
+ /// ```
667
+ pub fn f() {}
668
+ pub const Ě: i32 = 1;
669
+ pub const Ĕ: i32 = 2;
670
+ "# ,
671
+ )
672
+ . build ( ) ;
673
+
674
+ foo. cargo ( "check -Zlints" )
675
+ . masquerade_as_nightly_cargo ( & [ "lints" ] )
676
+ . with_stderr (
677
+ "\
678
+ [CHECKING] foo v0.0.1 ([CWD])
679
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
680
+ " ,
681
+ )
682
+ . run ( ) ;
683
+
684
+ foo. cargo ( "test --doc -Zlints" )
685
+ . masquerade_as_nightly_cargo ( & [ "lints" ] )
686
+ . with_stderr (
687
+ "\
688
+ [COMPILING] foo v0.0.1 ([CWD])
689
+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]s
690
+ [DOCTEST] foo
691
+ " ,
692
+ )
693
+ . run ( ) ;
694
+ }
You can’t perform that action at this time.
0 commit comments