@@ -349,15 +349,17 @@ Options for doctest execution.
349349 {missing_tests , [{atom (), arity ()}]} |
350350 {skip_tests , [moduledoc |
351351 {function | type | callback , atom (), arity ()}]} |
352- {verbose , boolean ()}].
352+ {verbose , boolean ()} |
353+ {compile_options , [compile :option ()]}].
353354
354355-record (options ,
355356 { parser = fun parse_markdown_builtin /1 :: fun ((unicode :unicode_binary ()) -> term ()),
356357 skipped_blocks = false :: non_neg_integer () | false ,
357358 missing_tests = false :: [{atom (), arity ()}] | false ,
358359 skip_tests = [] :: [moduledoc |
359360 {function | type | callback , atom (), arity ()}],
360- verbose = false :: boolean () }).
361+ verbose = false :: boolean (),
362+ compile_options = [] :: [compile :option ()] }).
361363
362364-doc #{equiv => module (Module , [])}.
363365-spec module (module ()) ->
@@ -639,6 +641,8 @@ options(OptionsList) ->
639641 Acc # options { skip_tests = proplists :get_value (skip_tests , OptionsList ) };
640642 (verbose , Acc ) ->
641643 Acc # options { verbose = proplists :get_value (verbose , OptionsList ) };
644+ (compile_options , Acc ) ->
645+ Acc # options { compile_options = proplists :get_value (compile_options , OptionsList ) };
642646 (_Key , Acc ) ->
643647 Acc
644648 end , # options {}, proplists :get_keys (OptionsList )).
@@ -755,15 +759,15 @@ run_test(Code, InitialBindings, Options) ->
755759 [ok ];
756760 {match , [_Line_Number , _Prefix = <<" -module(" >>, ModContent ]} ->
757761 [ModName | _ ] = binary :split (ModContent , [<<" )" >>]),
758- [compile_string (Code , ModName )];
762+ [compile_string (Code , ModName , Options # options . compile_options )];
759763 _ ->
760764 []
761765 end
762766 end .
763767
764- compile_string (Code , ModName ) ->
768+ compile_string (Code , ModName , CompileOptions ) ->
765769 FileName = unicode :characters_to_list (ModName ) ++ " .erl" ,
766- case compile :string (Code , [binary , return_errors , {source , FileName }]) of
770+ case compile :string (Code , [binary , return_errors , {source , FileName } | CompileOptions ]) of
767771 {ok , Module , Binary } ->
768772 {module , Module } = code :load_binary (Module , FileName , Binary ),
769773 ok ;
0 commit comments