text
stringlengths
0
601k
let test_int_hash_table_create_full test_ctxt = let counter_key = ref 0 in let counter_val = ref 0 in let module Int_hash_wth_destroy = GLib . Hash_table . Make ( struct type key = int let key = int type value = int let value = int let key_destroy_func = Some ( fun v -> counter_key := ( ! counter_key + ( !@ v ) ) ) let...
let test_int64_hash_table_create_full test_ctxt = let counter_key = ref ( Int64 . zero ) in let counter_val = ref ( Int64 . zero ) in let module Int64_hash_wth_destroy = GLib . Hash_table . Make ( struct type key = int64 let key = int64_t type value = int64 let value = int64_t let key_destroy_func = Some ( fun v -> cou...
let tests = " GLib2 Hash_table module tests " >::: [ " Test hash table create / insert / size " >:: test_hash_table_create_insert_size ; " Test hash table lookup " >:: test_hash_table_lookup ; " Test hash table lookup_extended " >:: test_hash_table_lookup_extended ; " Test hash table foreach " >:: test_hash_table_forea...
module StringResponse = Cohttp . Response . Make ( String_io . M )
let aes = Alcotest . check Alcotest . string
let aeso = Alcotest . check Alcotest . ( option string )
let t_credentials = Alcotest . testable ( fun fmt c -> let sexp = Cohttp . Auth . sexp_of_credential c in Sexplib0 . Sexp . pp_hum fmt sexp ) ( = )
let valid_auth ( ) = let auth = ` Basic ( " Aladdin " , " open sesame " ) in let h = H . add_authorization ( H . init ( ) ) auth in let digest = H . get h " authorization " in aeso " valid_auth 1 " digest ( Some " Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ " ) ; == Alcotest . check ( Alcotest . option t_credentials ) " valid_aut...
let valid_set_cookie ( ) = let c = Cohttp . Cookie . Set_cookie_hdr . make ~ expiration ` : Session ~ path " :/ foo / bar " ~ domain " : ocaml . org " ~ secure : true ~ http_only : true ( " key " , " value " ) in let k , v = Cohttp . Cookie . Set_cookie_hdr . serialize ~ version ` : HTTP_1_0 c in aes " header key " " S...
let cookie_printer x = String . concat " ; " ( List . map ( fun ( x , y ) -> x ^ " " : ^ y ) x )
let t_cookies = Alcotest . ( list ( pair string string ) )
let cookie_with_eq_val ( ) = let cookies = [ ( " test " , " me " ) = ] in let k , v = Cohttp . Cookie . Cookie_hdr . serialize cookies in let h = Cohttp . Header . of_list [ ( k , v ) ] in let cookies = Cohttp . Cookie . Cookie_hdr . extract h in Alcotest . check t_cookies " cookie_with_eq_val " cookies [ ( " test " , ...
let ignores_empty_cookie ( ) = let cookies = [ ( " foo " , " bar " ) ] in let k , v = Cohttp . Cookie . Cookie_hdr . serialize cookies in let v = " ; " ^ v in let h = Cohttp . Header . of_list [ ( k , v ) ] in let cookies = Cohttp . Cookie . Cookie_hdr . extract h in Alcotest . check t_cookies " cookie " cookies [ ( " ...
let valid_cookie ( ) = let cookies = [ ( " foo " , " bar " ) ; ( " a " , " b " ) ] in let k , v = Cohttp . Cookie . Cookie_hdr . serialize cookies in aes " key " " cookie " k ; aes " value " " foo = bar ; a = b " v ; let h = Cohttp . Header . of_list [ ( k , v ) ] in let cookies = Cohttp . Cookie . Cookie_hdr . extract...
let opt_printer f = function | None -> " nothing " | Some x -> Printf . sprintf " ' % s ' " ( f x )
let get_media_type ( ) = let mt = " foo / bar ; charset = UTF - 8 " in let header = Cohttp . Header . init_with " content - type " mt in Alcotest . check Alcotest . ( option string ) " media type " ( Some " foo / bar " ) ( Cohttp . Header . get_media_type header )
module Content_range = struct let h1 = H . of_list [ ( " Content - Length " , " 123 " ) ] let h2 = H . of_list [ ( " Content - Range " , " bytes 200 - 300 / 1000 " ) ] let aeio = Alcotest . ( check ( option int64 ) ) let none ( ) = aeio " none " None ( H . init ( ) |> H . get_content_range ) let content_length ( ) = ae...
let t_links = Alcotest . testable ( fun fmt links -> Format . pp_print_list ~ pp_sep : Format . pp_print_newline ( fun fmt l -> Format . fprintf fmt " % s " ( Link . to_string l ) ) fmt links ) ( = )
let headers_of_response test_name response_string = String_io . M . ( StringResponse . read ( String_io . open_in response_string ) >>= function | ` Ok resp -> Cohttp . Response . headers resp | _ -> failwith ( test_name ^ " response parse failed " ) )
let get_resp lines = " HTTP / 1 . 1 200 OK \ r \ n " ^ String . concat " \ r \ n " lines ^ " \ r \ n \ r \ n "
let empty_uri = Uri . of_string " "
let link_simple ( ) = let next_tgt = " / page / 2 " in let resp = get_resp [ " Link : " < ^ next_tgt ^ " ; > rel = next " ] in let headers = headers_of_response " link_simple " resp in Alcotest . check t_links " link_simple " Link . [ { context = empty_uri ; arc = Arc . { empty with relation = Rel . [ next ] } ; target...
let link_multi_rel ( ) = let next_tgt = " / page / 2 " in let resp = get_resp [ " Link : " < ^ next_tgt ^ " ; > rel " =\ next last " " \ ] in let headers = headers_of_response " link_multi_rel " resp in Alcotest . check t_links " link_multi_rel " Link . [ { context = empty_uri ; arc = Arc . { empty with relation = Rel ...
let link_multi_line ( ) = let self_tgt = " / page / 1 " in let next_tgt = " / page / 2 " in let resp = get_resp [ " Link : " < ^ next_tgt ^ " ; > rel " =\ next " " ; \ " Link : " < ^ self_tgt ^ " ; > rel = self " ; ] in let headers = headers_of_response " link_multi_line " resp in Alcotest . check t_links " link_multi_...
let link_multi_multi ( ) = let next_tgt = " / page / 2 " in let last_tgt = " / page / 3 " in let resp = get_resp [ " Link : " < ^ next_tgt ^ " ; > rel " =\ next " , \ " < ^ last_tgt ^ " ; > rel = last " ] in let headers = headers_of_response " link_multi_multi " resp in Alcotest . check t_links " link_multi_multi " Lin...
let link_rel_uri ( ) = let uri_tgt = " / page / 2 " in let uri_s = " http :// example . com / a , valid ; uri " in let resp = get_resp [ " Link : " < ^ uri_tgt ^ " ; > rel " =\ next " ^ uri_s ^ " " ; \ hreflang = en " ] in let headers = headers_of_response " link_rel_uri " resp in Alcotest . check t_links " link_rel_ur...
let link_anchor ( ) = let anchor = " / page / 2 " in let target = " / page / 1 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > anchor " " =\ ^ anchor ^ " " ; \ rel = prev " ] in let headers = headers_of_response " link_rel_uri " resp in Alcotest . check t_links " link_anchor " Link . [ { context = Uri . of_str...
let link_rev ( ) = let anchor = " / page / 2 " in let resp = get_resp [ " Link : " < ^ anchor ^ " ; > rev = prev " ] in let headers = headers_of_response " link_rev " resp in Alcotest . check t_links " link_multi_line " Link . [ { context = Uri . of_string anchor ; arc = Arc . { empty with reverse = true ; relation = R...
let link_media ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > media = screen " ] in let headers = headers_of_response " link_media " resp in Alcotest . check t_links " link_media " Link . [ { context = empty_uri ; arc = Arc . { empty with media = Some " screen " } ; target = Ur...
let link_media_complex ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > media " =\ screen , print and dpi < 200 " " \ ] in let headers = headers_of_response " link_media_complex " resp in Alcotest . check t_links " t_links " Link . [ { context = empty_uri ; arc = Arc . { empty wi...
let link_title ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > title " =\ Next " ; !\ rel = next " ] in let headers = headers_of_response " link_title " resp in Alcotest . check t_links " link_title " Link . [ { context = empty_uri ; arc = Arc . { empty with relation = Rel . [ n...
let link_title_star ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > title *= UTF - 8 ' en ' Next ; ! rel = next " ] in let headers = headers_of_response " link_title_star " resp in Alcotest . check t_links " link_title_star " Link . [ { context = empty_uri ; arc = Arc . { empty ...
let link_type_token ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > type = text / html ; rel = next " ] in let headers = headers_of_response " link_type_token " resp in Alcotest . check t_links " link_type_token " Link . [ { context = empty_uri ; arc = Arc . { empty with relatio...
let link_type_quoted ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > type " =\ text / html " ; \ rel = next " ] in let headers = headers_of_response " link_type_quoted " resp in Alcotest . check t_links " link_type_quoted " Link . [ { context = empty_uri ; arc = Arc . { empty wi...
let link_ext ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > see = saw ; rel = next " ] in let headers = headers_of_response " link_ext " resp in Alcotest . check t_links " link_ext " Link . [ { context = empty_uri ; arc = Arc . { empty with relation = Rel . [ next ] ; extension...
let link_ext_star ( ) = let target = " / page / 2 " in let resp = get_resp [ " Link : " < ^ target ^ " ; > zig ' ' *= zag ; rel = next " ] in let headers = headers_of_response " link_ext " resp in Alcotest . check t_links " link_ext_star " Link . [ { context = empty_uri ; arc = Arc . { empty with relation = Rel . [ nex...
let trim_ws ( ) = let resp = get_resp [ " Age : 281 " ] in let headers = headers_of_response " trim whitespace " resp in aeso " trim_ws " ( H . get headers " age " ) ( Some " 281 " )
let test_cachecontrol_concat ( ) = let resp = get_resp [ " Cache - Control : public " ; " Cache - Control : max - age : 86400 " ] in let h = headers_of_response " concat Cache - Control " resp in aeso " test_cachecontrol_concat " ( Some " public , max - age : 86400 " ) ( H . get_multi_concat h " Cache - Control " )
let ( ) = Printexc . record_backtrace true
let ( ) = Alcotest . run " test_header " [ ( " Link " , [ ( " simple " , ` Quick , link_simple ) ; ( " multiple rels " , ` Quick , link_multi_rel ) ; ( " multiple lines " , ` Quick , link_multi_line ) ; ( " multiheader " , ` Quick , link_multi_multi ) ; ( " rel uri " , ` Quick , link_rel_uri ) ; ( " anchor " , ` Quick ...
let check msg ~ expect actual = Alcotest ( . check ( list ( pair string string ) string ) string ) string msg expect ( Headers . to_list actual ) actual ; ;
let test_replace ( ) = check " replace trailing element " ~ expect [ " : c " , " d " ; " a " , " d ] " ( Headers . replace ( Headers . of_list [ " c " , " d " ; " a " , " b ] ) " " a " " d ) " ; check " replace middle element " ~ expect [ " : e " , " f " ; " c " , " z " ; " a " , " b ] " ( Headers . replace ( Headers ....
let test_remove ( ) = check " remove leading element " ~ expect [ " : c " , " d ] " ( Headers . remove ( Headers . of_list [ " a " , " b " ; " c " , " d ] ) " " a ) " ; check " remove trailing element " ~ expect [ " : c " , " d ] " ( Headers . remove ( Headers . of_list [ " c " , " d " ; " a " , " b ] ) " " a ) " ; ; ;
let test_ci_equal ( ) = let string_of_char x = String . init 1 ( fun _ -> x ) x in let ascii = Array . init ( 0xff + 1 ) 1 ~ f : Char . chr |> Array . to_list in let ascii_pairs = List . map ascii ~ f ( : fun x -> List . map ascii ~ f ( : fun y -> x , y ) y ) y |> List . concat in List . iter ascii_pairs ~ f ( : fun ( ...
let tests = [ " remove " , ` Quick , test_remove ; " replace " , ` Quick , test_replace ; " CI equal " , ` Quick , test_ci_equal ]
module Camlboy = Camlboy . Make ( Rom_only )
let run_test_rom_and_print_framebuffer file = let rom_bytes = Read_rom_file . f file in let camlboy = Camlboy . create_with_rom ~ rom_bytes ~ print_serial_port : false in let rec loop ( ) = let run_result = Camlboy . run_instruction camlboy in let prev_instr = Camlboy . For_tests . prev_inst camlboy in match prev_instr...
let l_to_prob = List . map ~ f ( : fun ( x , p ) -> ( x , Prob . of_float p ) )
let l_of_prob = List . map ~ f ( : fun ( x , p ) -> ( x , Prob . to_float p ) )
let test_normalise_sum_to_1 = QCheck_alcotest . to_alcotest @@ QCheck . Test . make ~ count : 1000 ~ name " : test normalisation " QCheck . ( list ( pair int float ) ) Float . ( fun l -> if Stdlib . ( l = [ ] ) then true else abs ( ( List . sum ( module Float ) ~ f : snd @@ l_of_prob @@ normalise ( l_to_prob l ) ) - 1 ...
let test_norms ( desc , input , expected ) ( ) = let input = l_to_prob input in Alcotest . ( check ( list ( pair char ( float 0 . 00001 ) ) ) ) desc ( l_of_prob @@ normalise input ) expected
let normalise_io = [ ( " empty lists " , [ ] , [ ] ) ; ( " sums to less than one " , [ ( ' a ' , 0 . 5 ) ] , [ ( ' a ' , 1 . ) ] ) ; ( " sums to greater than one " , [ ( ' a ' , 1 . 5 ) ] , [ ( ' a ' , 1 . ) ] ) ; ( " correct weights " , [ ( ' a ' , 0 . 2 ) ; ( ' b ' , 0 . 6 ) ] , [ ( ' a ' , 0 . 25 ) ; ( ' b ' , 0 . 7...
let normalise_tests = List . map normalise_io ~ f ( : fun t -> ( fst3 t , ` Quick , test_norms t ) )
let test_unduplicate ( ) = Alcotest . ( check ( list ( pair int ( float 0 . 0000001 ) ) ) ) " " ( l_of_prob ( unduplicate @@ l_to_prob [ ( 1 , 0 . 2 ) ; ( 1 , 0 . 4 ) ] ) ) [ ( 1 , 0 . 6 ) ]
let test_print ( ) = let d = from_primitive ( Primitive . categorical [ ( 1 , 0 . 6 ) ; ( 2 , 0 . 4 ) ] ) in Alcotest . ( check unit ) " " ( print_exact_exn ( module Base . Int ) d ) ( )
let test_memoisation memo ( ) = let r = ref 0 in let f _ = incr r ; ! r + 1 in let f = memo f in let x = f 1 in let x ' = f 1 in let y = f 2 in Alcotest . ( check ( list int ) ) " " [ x ; x ' ; y ] [ 2 ; 2 ; 3 ]
let todo ( ) = ( )
let w = weighted_dist ~ n : 10 ( categorical [ ( 1 , 0 . 5 ) ] )
let test_sample_mean ( ) = let i = infer Unit_test_models . single_coin ( MH 100 ) in let m = sample_mean ~ n : 1000 i in Alcotest . ( check ( float 0 . 5 ) ) " " m 0 . 83
let tests : unit Alcotest . test list = [ ( " normalise " , normalise_tests ) ; ( " unduplicate " , [ ( " no duplicates " , ` Quick , test_unduplicate ) ; ( " correct sums " , ` Quick , todo ) ; ] ) ; ( " memoise " , [ ( " for an incrementing function " , ` Quick , test_memoisation memo ) ; ( " for an incrementing func...
let test_baking_rights ( ) = Context . init 2 >>=? fun ( b , contracts ) -> let open Plugin . RPC . Baking_rights in get Block . rpc_ctxt b ~ all : true >>=? fun rights -> assert ( Compare . List_length_with . ( rights = 65 ) ) ; let max_round = 15 in get Block . rpc_ctxt b ~ all : true ~ max_round >>=? fun rights -> a...
let tests = [ Tztest . tztest " baking_rights " ` Quick test_baking_rights ]
let require_same here ( name1 , string1 ) ( name2 , string2 ) = require here ( String . equal string1 string2 ) ~ if_false_then_print_s : ( lazy [ % message " output differs unexpectedly " ~ _ ( : name1 , string1 : string * string ) ~ _ ( : name2 , string2 : string * string ) ] ) ; ;
let test_m ( type a ) here ( module T : Hexdump . S with type t = a ) ? max_lines ? pos ? len t = let to_string_hum = T . Hexdump . to_string_hum ? max_lines ? pos ? len t in let to_sequence = T . Hexdump . to_sequence ? max_lines ? pos ? len t |> Sequence . to_list |> String . concat ~ sep " :\ n " in require_same her...
let test ? max_lines ? pos ? len string = let of_string = test_m [ % here ] ( module String ) ? max_lines ? pos ? len string in print_endline of_string ; let of_bigstring = test_m [ % here ] ( module Bigstring ) ? max_lines ? pos ? len ( Bigstring . of_string string ) in require_same [ % here ] ( " String . Hexdump . t...
let string = " Good morning . In less than an hour , aircraft from here will join others from around \ the world . And you will be launching the largest aerial battle in the history of \ mankind . " \ Mankind . " \ That word should have new meaning for all of us today . We \ can ' t be consumed by our petty differences...
module Common_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct module M = Functions . Stubs ( S ) open M let test_higher_order_basic _ = assert_equal 1 ( higher_order_1 ( + ) 2 3 ) ; assert_equal 0 ( higher_order_1 ( * ) 2 3 ) ; assert_equal 0 ( higher_order_1 min 2 3 ) ; ass...
let suite = " Higher - order tests " >::: [ " test_higher_order_basic ( foreign ) " >:: Foreign_tests . test_higher_order_basic ; " test_higher_order_basic ( stubs ) " >:: Stub_tests . test_higher_order_basic ; " test_higher_higher_order ( foreign ) " >:: Foreign_tests . test_higher_higher_order ; " test_higher_higher_...
let _ = run_test_tt_main suite
let button ? at onclick label = let but = El . button ? at [ El . txt ( Jstr . v label ) ] in Ev . listen Ev . click ( fun _e -> onclick ( ) ) ( El . as_target but ) ; but
let with_frag frag u = Uri . with_uri ~ fragment ( : Jstr . v frag ) u
let test_history ( ) = let h = Window . history G . window in let loc = Window . location G . window in Window . History . push_state h ~ uri ( : with_frag " h1 " loc |> Result . get_ok ) ; Window . History . push_state h ~ uri ( : with_frag " h2 " loc |> Result . get_ok ) ; Window . History . push_state h ~ uri ( : wi...
let test_no_reload ( ) = let loc = Window . location G . window in Window . set_location G . window ( with_frag " l1 " loc |> Result . get_ok ) ; Window . set_location G . window ( with_frag " l2 " loc |> Result . get_ok ) ; ( )
let test_back ( ) = Window . History . back ( Window . history G . window )
let test_forward ( ) = Window . History . forward ( Window . history G . window )
let test_reload ( ) = Window . reload G . window
let main ( ) = let noreload = button test_no_reload " Set window location " in let history = button test_history " Use history API " in let reload = button test_reload " Reload window " in let prev = button test_back " ← prev " in let next = button test_forward " next " → in let children = [ El . p [ prev ; next ] ; El...
let ( ) = main ( )
let invalid_history_mode_switch ~ previous_mode ~ target_mode = Alcotest . fail ( Format . asprintf " Invalid switch from % a to % a " History_mode . pp previous_mode History_mode . pp target_mode )
let expected_savepoint chain_store current_head blocks_per_cycle ~ previous_mode ~ target_mode = let open Lwt_result_syntax in let * current_head_metadata = Store . Block . get_block_metadata chain_store current_head in let head_lafl = Store . Block . last_allowed_fork_level current_head_metadata in let max_op_ttl = St...
let expected_caboose chain_store current_head blocks_per_cycle ~ previous_mode ~ target_mode savepoint = let open Lwt_result_syntax in match target_mode with | Archive -> return 0l | Full _ -> return 0l | Rolling offset -> ( let target_offset = ( Option . value offset ~ default : History_mode . default_additional_cycle...
let check_consistency_after_switch descr chain_store ~ previous_mode ~ target_mode blocks = let open Lwt_result_syntax in let current_head = List . ( hd ( rev blocks ) ) |> WithExceptions . Option . get ~ loc : __LOC__ in let * Tezos_protocol_alpha . Protocol . Alpha_context . Constants . { parametric = { blocks_per_cy...
let test ~ test_descr ~ from_hm ~ to_hm ~ nb_blocks_to_bake ( store_dir , context_dir ) store ~ patch_context = let open Lwt_result_syntax in let chain_store = Store . main_chain_store store in let *! genesis_block = Store . Chain . genesis_block chain_store in let * ( previously_baked_blocks , _current_head ) = Alpha_...
let make_tests speed patch_context = let history_modes = match speed with | ` Slow -> [ Archive ; Full ( Some { offset = 0 } ) ; Full ( Some { offset = 3 } ) ; default_full ; Full ( Some { offset = 7 } ) ; Full ( Some { offset = 10 } ) ; Rolling ( Some { offset = 0 } ) ; Rolling ( Some { offset = 3 } ) ; default_rollin...
let tests speed = let patch_context ctxt = Alpha_utils . default_patch_context ctxt in let test_cases = make_tests speed patch_context in ( " history_mode_switch " , test_cases )
let test_encode__normal ctxt = let open Fixture . KernelInfoRequest in let key = Hmac . create key in let actual = Hmac . encode ~ key ~ header ~ parent_header ~ metadata ~ content ( ) in assert_equal ~ ctxt ~ printer [ :% show : string ] actual hmac ; let open Fixture . ExecuteRequest in let key = Hmac . create key in...
let test_encode__nokey ctxt = let open Fixture . KernelInfoRequest in let actual = Hmac . encode ~ header ~ parent_header ~ metadata ~ content ( ) in assert_equal ~ ctxt ~ printer [ :% show : string ] actual " " ; let open Fixture . ExecuteRequest in let actual = Hmac . encode ~ header ~ parent_header ~ metadata ~ cont...
let test_validate__success _ = let open Fixture . KernelInfoRequest in let key = Hmac . create key in Hmac . validate ~ key ~ hmac ~ header ~ parent_header ~ metadata ~ content ( ) ; let open Fixture . ExecuteRequest in let key = Hmac . create key in Hmac . validate ~ key ~ hmac ~ header ~ parent_header ~ metadata ~ co...
let test_validate__failure _ = let open Fixture . KernelInfoRequest in let key = Hmac . create key in assert_raises ( Failure " HMAC validation failed " ) ( fun ( ) -> Hmac . validate ~ key ~ hmac " " : ~ header ~ parent_header ~ metadata ~ content ( ) ) ; let open Fixture . ExecuteRequest in let key = Hmac . create ke...
let test_validate__nokey _ = let open Fixture . KernelInfoRequest in Hmac . validate ~ hmac ~ header ~ parent_header ~ metadata ~ content ( ) ; let open Fixture . ExecuteRequest in Hmac . validate ~ hmac ~ header ~ parent_header ~ metadata ~ content ( )
let suite = " Hmac " >::: [ " encode " >::: [ " normal " >:: test_encode__normal ; " nokey " >:: test_encode__nokey ; ] ; " validate " >::: [ " success " >:: test_validate__success ; " failure " >:: test_validate__failure ; " nokey " >:: test_validate__nokey ; ] ; ]
let t = Wrap . ( " some - hook " <: Normal_hook )
let ( ) = clear t
let show t = print_s [ % sexp ( t : _ t ) ]
let create_function s = Function . create ( s |> Symbol . intern ) [ % here ] ~ docstring " :< docstring " > ~ hook_type : Normal_hook ( Returns Value . Type . unit ) ( fun ( ) -> print_s [ % message s ] ) ; ;
let f1 = create_function " f1 "
let f2 = create_function " f2 "
let f3 = create_function " f3 " show t ; [ % expect { | ( ( symbol some - hook ) ( hook_type Normal_hook ) ( value ( ( ) ) ) ) } ] ; | add t f1 ; show t ; [ % expect { | ( ( symbol some - hook ) ( hook_type Normal_hook ) ( value ( ( f1 ) ) ) ) } ] ; | add t f2 ; show t ; [ % expect { | ( ( symbol some - hook ) ( hook_t...
let create_after_load_fun s = Function . create ( s |> Symbol . intern ) [ % here ] ~ docstring " :< docstring " > ~ hook_type : File_hook ( Returns Value . Type . unit ) ( fun _ -> print_endline s ) ; ; let f1 = create_after_load_fun " f1 " in let f2 = create_after_load_fun " f2 " in add after_load f1 ; add after_load...
let doctype ? name ? public_identifier ? system_identifier ( ? force_quirks = false ) ( ) = { doctype_name = name ; public_identifier ; system_identifier ; raw_text = None ; force_quirks }