File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,7 @@ fn partition_source(s: &str) -> (String, String) {
416416 let trimline = line. trim ( ) ;
417417 let header = trimline. is_whitespace ( ) ||
418418 trimline. starts_with ( "#![" ) ||
419+ trimline. starts_with ( "#[macro_use] extern crate" ) ||
419420 trimline. starts_with ( "extern crate" ) ;
420421 if !header || after_header {
421422 after_header = true ;
@@ -827,6 +828,24 @@ assert_eq!(2+2, 4);
827828 assert_eq ! ( output, ( expected, 2 ) ) ;
828829 }
829830
831+ #[ test]
832+ fn make_test_manual_extern_crate_with_macro_use ( ) {
833+ let opts = TestOptions :: default ( ) ;
834+ let input =
835+ "#[macro_use] extern crate asdf;
836+ use asdf::qwop;
837+ assert_eq!(2+2, 4);" ;
838+ let expected =
839+ "#![allow(unused)]
840+ #[macro_use] extern crate asdf;
841+ fn main() {
842+ use asdf::qwop;
843+ assert_eq!(2+2, 4);
844+ }" . to_string ( ) ;
845+ let output = make_test ( input, Some ( "asdf" ) , false , & opts) ;
846+ assert_eq ! ( output, ( expected, 2 ) ) ;
847+ }
848+
830849 #[ test]
831850 fn make_test_opts_attrs ( ) {
832851 //if you supplied some doctest attributes with #![doc(test(attr(...)))], it will use those
You can’t perform that action at this time.
0 commit comments