File tree 1 file changed +19
-0
lines changed
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) {
416
416
let trimline = line. trim ( ) ;
417
417
let header = trimline. is_whitespace ( ) ||
418
418
trimline. starts_with ( "#![" ) ||
419
+ trimline. starts_with ( "#[macro_use] extern crate" ) ||
419
420
trimline. starts_with ( "extern crate" ) ;
420
421
if !header || after_header {
421
422
after_header = true ;
@@ -827,6 +828,24 @@ assert_eq!(2+2, 4);
827
828
assert_eq ! ( output, ( expected, 2 ) ) ;
828
829
}
829
830
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
+
830
849
#[ test]
831
850
fn make_test_opts_attrs ( ) {
832
851
//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