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 ;
@@ -825,6 +826,24 @@ assert_eq!(2+2, 4);
825
826
assert_eq ! ( output, ( expected, 2 ) ) ;
826
827
}
827
828
829
+ #[ test]
830
+ fn make_test_manual_extern_crate_with_macro_use ( ) {
831
+ let opts = TestOptions :: default ( ) ;
832
+ let input =
833
+ "#[macro_use] extern crate asdf;
834
+ use asdf::qwop;
835
+ assert_eq!(2+2, 4);" ;
836
+ let expected =
837
+ "#![allow(unused)]
838
+ #[macro_use] extern crate asdf;
839
+ fn main() {
840
+ use asdf::qwop;
841
+ assert_eq!(2+2, 4);
842
+ }" . to_string ( ) ;
843
+ let output = make_test ( input, Some ( "asdf" ) , false , & opts) ;
844
+ assert_eq ! ( output, ( expected, 2 ) ) ;
845
+ }
846
+
828
847
#[ test]
829
848
fn make_test_opts_attrs ( ) {
830
849
//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