text stringlengths 0 601k |
|---|
let assert_float64_equal f1 f2 = assert_float_equal f1 f2 Float . epsilon_float |
let assert_raises_invalid_arg f = try let _ = f ( ) in assert_failure " did not raise Invalid_argument " with Invalid_argument _ -> ( ) |
let assert_raises_out_of_int_range f = try let _ = f ( ) in assert_failure " did not raise Out_of_int_range " with Capnp . Message . Out_of_int_range _ -> ( ) |
let init_test_message ( s : T . Builder . TestAllTypes . t ) t : unit = let open T . Builder . TestAllTypes in void_field_set s ; bool_field_set s true ; int8_field_set_exn s ( - 123 ) 123 ; int16_field_set_exn s ( - 12345 ) 12345 ; int32_field_set s ( - 12345678l ) 12345678l ; int64_field_set s ( - 123456789012345L ) ... |
module type TEST_ALL_TYPES = sig type t type array_t type ' a message_t type access type message_access type inner_struct_t val void_field_get : t -> unit val bool_field_get : t -> bool val int8_field_get : t -> int val int16_field_get : t -> int val int32_field_get : t -> int32 val int32_field_get_int_exn : t -> int v... |
module Check_test_message ( Outer : TEST_ALL_TYPES ) TEST_ALL_TYPES ( Inner : TEST_ALL_TYPES with type t = Outer . inner_struct_t and type inner_struct_t = Outer . inner_struct_t ) inner_struct_t let f ( s : Outer . t ) t : unit = let open Outer in assert_equal ( ) ( void_field_get s ) s ; assert_equal true ( bool_fiel... |
module ReaderTestAllTypes = struct include T . Reader . TestAllTypes type ' a message_t = ' a T . message_t type array_t = T . Reader . array_t type access = Test . ro type message_access = Test . ro type inner_struct_t = t end |
module BuilderTestAllTypes = struct include T . Builder . TestAllTypes type ' a message_t = ' a T . message_t type array_t = T . Builder . array_t type access = Test . rw type message_access = Test . rw type inner_struct_t = t end |
module ReaderTestDefaults = struct include T . Reader . TestDefaults type ' a message_t = ' a T . message_t type array_t = T . Reader . array_t type access = Test . ro type message_access = Test . ro type inner_struct_t = T . Reader . TestAllTypes . t end |
module BuilderTestDefaults = struct include T . Builder . TestDefaults type ' a message_t = ' a T . message_t type array_t = T . Builder . array_t type access = Test . rw type message_access = Test . rw type inner_struct_t = T . Builder . TestAllTypes . t end |
let test_encode_decode _ctx = let builder = T . Builder . TestAllTypes . init_root ( ) in let ( ) = init_test_message builder in let ( ) = Builder_check_test_message . f builder in let reader = T . Reader . TestAllTypes . of_builder builder in Reader_check_test_message . f reader |
let test_decode_defaults _ctx = let null_root = Bytes . of_string " \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 " in let message = BM . Message . readonly ( BM . Message . of_storage [ null_root ] ) in let reader = T . Reader . TestDefaults . of_message message in Reader_check_test_defaults . f reader |
let test_init_defaults _ctx = let null_root = Bytes . of_string " \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 " in let message = BM . Message . of_storage [ null_root ] in let builder = T . Builder . TestDefaults . of_message message in let ( ) = Builder_check_test_defaults . f builder in let ( ) = Builder_check_te... |
let test_union_encoding _ctx = let open T . Builder . TestUnion in let root = init_root ( ) in let union0 = union0_get root in assert_equal Union0 . U0f0s0 ( Union0 . get union0 ) union0 ; Union0 . u0f0s1_set union0 true ; assert_equal ( Union0 . U0f0s1 true ) true ( Union0 . get union0 ) union0 ; Union0 . u0f0s8_set_e... |
let init_union ( setter : T . Builder . TestUnion . t -> ' a ) ' a = let builder = T . Builder . TestUnion . init_root ~ message_size : 1024 ( ) in let _ = setter builder in let message = BM . Message . readonly ( T . Builder . TestUnion . to_message builder ) builder in let segment = BM . Message . get_segment message... |
let test_union_layout _ctx = let open T . Builder . TestUnion in assert_equal ( [ 0 ; 0 ; 0 ; 0 ] , None ) None ( init_union ( fun b -> Union0 . u0f0s0_set ( union0_get b ) b ) b ) b ; assert_equal ( [ 1 ; 0 ; 0 ; 0 ] , Some 0 ) 0 ( init_union ( fun b -> Union0 . u0f0s1_set ( union0_get b ) b true ) true ) true ; asser... |
let test_unnamed_union_encoding _ctx = let module R = T . Reader . TestUnnamedUnion in let module B = T . Builder . TestUnnamedUnion in let root = B . init_root ( ) in assert_equal ( B . Foo 0 ) 0 ( B . get root ) root ; B . bar_set_int_exn root 321 ; assert_equal ( B . Bar ( Uint32 . of_int 321 ) 321 ) 321 ( B . get r... |
let test_groups _ctx = let open T . Builder . TestGroups in let root = init_root ( ) in let ( ) = let groups = groups_get root in let foo = Groups . foo_init groups in Groups . Foo . corge_set foo 12345678l ; Groups . Foo . grault_set foo 123456789012345L ; Groups . Foo . garply_set foo " foobar " ; assert_equal 123456... |
let test_interleaved_groups _ctx = let module B = T . Builder . TestInterleavedGroups in let module R = T . Reader . TestInterleavedGroups in let root = B . init_root ( ) in let ( ) = let group = B . group1_get root in B . Group1 . foo_set_int_exn group 12345678 ; B . Group1 . bar_set group ( Uint64 . of_string " 12345... |
let test_union_defaults _ctx = let module B = T . Builder . TestUnionDefaults in let module R = T . Reader . TestUnionDefaults in let reader = R . of_builder ( B . init_root ( ) ) in let ( ) = let field = R . s16s8s64s8_set_get reader in let module TU = T . Reader . TestUnion in begin match TU . Union0 . get ( TU . uni... |
module type TEST_LISTS = sig type t type array_t type ' a message_t type access type message_access type test_all_types_t module Struct8 : sig type t val f_get : t -> int val of_message : message_access message_t -> t end module Struct16c : sig type t val f_get : t -> int val has_pad : t -> bool val pad_get : t -> stri... |
let init_list_defaults ( lists : T . Builder . TestLists . t ) t = let open T . Builder . TestLists in let list8 = list8_init lists 2 in let list16 = list16_init lists 2 in let list32 = list32_init lists 2 in let list64 = list64_init lists 2 in let listp = list_p_init lists 2 in Struct8 . f_set_exn ( Capnp . Array . ge... |
module Check_test_list ( TL : TEST_LISTS ) TEST_LISTS ( TAT : TEST_ALL_TYPES with type t = TL . test_all_types_t ) test_all_types_t let f ( lists : TL . t ) t = assert_equal 2 ( Capnp . Array . length ( TL . list8_get lists ) lists ) lists ; assert_equal 2 ( Capnp . Array . length ( TL . list16_get lists ) lists ) list... |
module ReaderTestLists = struct include T . Reader . TestLists type array_t = T . Reader . array_t type ' a message_t = ' a T . message_t type access = Test . ro type message_access = Test . ro type test_all_types_t = T . Reader . TestAllTypes . t end |
module BuilderTestLists = struct include T . Builder . TestLists type array_t = T . Builder . array_t type ' a message_t = ' a T . message_t type access = Test . rw type message_access = Test . rw type test_all_types_t = T . Builder . TestAllTypes . t end |
let test_list_defaults _ctx = let root = T . Builder . TestListDefaults . init_root ( ) in let lists = T . Builder . TestListDefaults . lists_get root in Reader_check_test_list . f ( T . Reader . TestLists . of_builder lists ) lists ; Builder_check_test_list . f lists ; Reader_check_test_list . f ( T . Reader . TestLis... |
let test_build_list_defaults _ctx = let root = T . Builder . TestLists . init_root ( ) in let ( ) = init_list_defaults root in Reader_check_test_list . f ( T . Reader . TestLists . of_builder root ) root ; Builder_check_test_list . f root ; Reader_check_test_list . f ( T . Reader . TestLists . of_builder root ) root |
let test_upgrade_struct_in_builder _ctx = let old_reader , message = let open T . Builder . TestOldVersion in let root = init_root ( ) in old1_set root 123L ; old2_set root " foo " ; let sub = old3_init root in old1_set sub 456L ; old2_set sub " bar " ; ( to_reader root , to_message root ) root in let ( ) = let module ... |
let check_upgraded_list message expected_data expected_pointers = let ( ) = let tnvl = TL . Builder . TestNewVersionList . of_message message in let builder_list = TL . Builder . TestNewVersionList . a_get tnvl in assert_equal ( Capnp . Array . length builder_list ) builder_list ( Array . length expected_data ) expecte... |
let test_upgrade_list_in_builder _ctx = let ( ) = let root = TL . Builder . VoidList . init_root ( ) in let ( _ : ( _ , _ , _ ) _ Capnp . Array . t ) t = TL . Builder . VoidList . a_set_list root [ ( ) ; ( ) ; ( ) ; ( ) ; ] in assert_equal ( TL . Builder . VoidList . a_get_list root ) root [ ( ) ; ( ) ; ( ) ; ( ) ; ] ;... |
let test_nested_types_encoding _ctx = let open T . Reader . TestNestedTypes in let reader = of_builder ( T . Builder . TestNestedTypes . init_root ( ) ) in assert_equal NestedEnum . Bar ( outer_nested_enum_get reader ) reader ; assert_equal NestedStruct . NestedEnum . Quux ( inner_nested_enum_get reader ) reader ; let ... |
let test_imports _ctx = let ( ) = let root = TI . Builder . TestImport . init_root ( ) in let ( ) = init_test_message ( TI . Builder . TestImport . field_init root ) root in let reader = TI . Builder . TestImport . to_reader root in Reader_check_test_message . f ( TI . Reader . TestImport . field_get reader ) reader in... |
let test_iface_imports _ctx = let module Builder = TII . Builder . TestIfaceImport . M0 . Params in let root = Builder . init_root ( ) in init_test_message ( Builder . x_init root ) root ; let reader = Builder . to_reader root in let module Reader = TII . Reader . TestIfaceImport . M0 . Params in Reader_check_test_mess... |
let test_constants _ctx = let open T . Reader . TestConstants in assert_equal ( ) void_const ; assert_equal true bool_const ; assert_equal ( - 123 ) 123 int8_const ; assert_equal ( - 12345 ) 12345 int16_const ; assert_equal ( - 12345678l ) 12345678l int32_const ; assert_equal ( - 123456789012345L ) 123456789012345L int... |
let test_global_constants _ctx = let open T . Reader . TestAllTypes in assert_equal ( Uint32 . of_int 12345 ) 12345 T . Reader . global_int ; assert_equal " foobar " T . Reader . global_text ; assert_equal 54321l ( int32_field_get T . Reader . global_struct ) global_struct ; assert_equal ( Uint32 . of_int 12345 ) 12345... |
let test_int_accessors _ctx = let module R = T . Reader . TestAllTypes in let module B = T . Builder . TestAllTypes in let root = B . init_root ( ) in let rroot = R . of_builder root in B . int64_field_set_int root Int . max_value ; assert_equal ( B . int64_field_get_int_exn root ) root Int . max_value ; assert_equal (... |
let test_any_pointers _ctx = let root = T . Builder . TestAnyPointer . init_root ( ) in let ptr = T . Builder . TestAnyPointer . any_pointer_field_get root in let child = T . Builder . TestSturdyRefHostId . init_pointer ptr in T . Builder . TestSturdyRefHostId . host_set child " test - host " ; let rroot = T . Reader .... |
let encoding_suite = " all_types " >::: [ " encode / decode " >:: test_encode_decode ; " decode defaults " >:: test_decode_defaults ; " init defaults " >:: test_init_defaults ; " union encode / decode " >:: test_union_encoding ; " union layout " >:: test_union_layout ; " unnamed union encode / decode " >:: test_unnamed... |
let usage = " Arg module testing " |
let test total i ( spec , anon , argv ) = let argv = Array . of_list ( " testerror " :: argv ) in try Arg . parse_argv ~ current ( : ref 0 ) argv spec anon usage with | Arg . Bad s -> Printf . printf " ( % d /% d ) Bad :\ n % s \ n " ( i + 1 ) total s | Arg . Help s -> Printf . printf " ( % d /% d ) Help :\ n % s \ n "... |
let tests = [ [ " - s " , Arg . String ignore , " missing arg " ] , ignore , [ " - s " ] [ " - int " ; " not_an_int " ] Arg . Unit ( fun ( ) -> raise @@ Arg . Bad ( " User - raised error bis " ) ) , " user raised error " ] , ignore , [ " - tuple = 1 " ] ] |
let ( ) = let n = List . length tests in List . iteri ( test n ) tests |
let all_tests = [ " flags " , ( fun test_ctxt t -> oasis_setup test_ctxt t ; register_generated_files t ( oasis_ocamlbuild_files @ [ " src / simplelib / simplelib . mllib " ; " src / simplelib / simplelib . mldylib " ; " src / simplelib / simplelib . odocl " ; " src / simplelibext / simplelibext . mllib " ; " src / sim... |
let tests_match_native = [ " plugins / oasis - plugin - print - hello " , ( fun test_ctxt t -> let assert_oasis_cli_output_contains args lst = let _ , extra_env = TestFullUtils . ocaml_env test_ctxt t in assert_oasis_cli ~ extra_env ~ ctxt : test_ctxt ~ output_contains : lst args in let t = install_oasis_library test_c... |
let gen_tests ? is_native tests = let runner ( nm , f ) = ( " examples " /^ nm ) >:: ( fun test_ctxt -> let ( ) = skip_long_test test_ctxt in let is_native = match is_native with | Some b -> b | None -> TestCommon . is_native test_ctxt in let t = setup_test_directories test_ctxt ~ is_native ~ native_dynlink : is_native... |
let tests = " TestExamples " >::: [ " best = native " >::: ( skip_test_on_non_native_arch ( gen_tests ~ is_native : true all_tests ) ) ; " best = byte " >::: ( gen_tests ~ is_native : false all_tests ) ; " best = matching " >::: ( gen_tests tests_match_native ) ; " all_examples " >:: ( fun test_ctxt -> all_subdirectori... |
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2015 - 02 - 02 " ] ) ; ( " Action " , [ " TestFailover " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render ( ... |
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " TestFailoverResponse " ( snd xml ) ) ( Xml . member " TestFailoverResult " ) in try Util . or_error ( Util . option_bind resp TestFailoverResult . parse ) ( let open Error in BadResponse { body ; message = " Cou... |
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None |
let printer_change = function | Create fn -> Printf . sprintf " Create % S " fn | Change ( fn , Some fn ' ) -> Printf . sprintf " Change ( % S , Some % s ) " fn fn ' | Change ( fn , None ) -> Printf . sprintf " Change ( % S , None ) " fn | NoChange -> " NoChange " |
let tests = let test_of_vector ( fn , content_lst , comment_fmt ) = fn >:: ( fun test_ctxt -> let real_fn = in_testdata_dir test_ctxt [ " TestFileTemplate " ; fn ] in let tmpdir = bracket_tmpdir test_ctxt in let expected_fn = real_fn ^ " - exp " in let tmp_fn = if Sys . file_exists real_fn then FileUtil . cp [ real_fn ... |
let tests = " ODBFSMemory " >::: [ " Simple " >:: ( fun ( ) -> let fstree = ODBFSTree . root ( ) in let fs = new ODBFSMemory . read_write fstree in Lwt_main . run ( ODBVFS . with_file_out fs " foo " ( fun chn -> Lwt_io . write chn " abcde " ) >>= fun ( ) -> fs # mkdir " bar " 0o755 >>= fun ( ) -> ODBVFS . with_file_in ... |
let all_tests = [ " 1level " , ( fun test_ctxt t -> oasis_setup test_ctxt t ; register_generated_files t ( oasis_ocamlbuild_files @ [ " META " ; " with - a . mllib " ; " with - a . mldylib " ; " with - a . odocl " ; ] ) ; register_installed_files test_ctxt t [ InstalledOCamlLibrary ( " with - a " , [ " META " ; " A . m... |
let different_directory_tests = [ " TEMP = a b " , " bug571 " , ( fun test_ctxt t -> let tmpdir = bracket_tmpdir test_ctxt in let dn = Filename . concat tmpdir " a b " in mkdir dn ; oasis_setup test_ctxt t ; register_generated_files t oasis_ocamlbuild_files ; standard_checks test_ctxt t ; run_ocaml_setup_ml test_ctxt t... |
let gen_tests ~ is_native ( ) = let runner ( nm , dn , f ) = nm >:: ( fun test_ctxt -> let ( ) = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt ~ is_native ~ native_dynlink ( : is_native && ( native_dynlink test_ctxt ) ) ( in_testdata_dir test_ctxt [ " TestFull " ; dn ] ) in f test_ctxt t ) in Lis... |
let tests = " TestFull " >::: [ " all_TestFull " >:: ( fun test_ctxt -> all_subdirectories test_ctxt ( in_testdata_dir test_ctxt [ " TestFull " ] ) ( ( List . map fst all_tests ) @ ( List . map ( fun ( _ , a , _ ) -> a ) different_directory_tests ) ) ( Printf . sprintf " test / data / TestFull /% s is not tested . " ) ... |
let ext_lib = Conf . make_string " ext_lib " " . a " " Default extension for static library . " |
let ext_dll = let dflt = if Sys . os_type = " Win32 " then " . dll " else " . so " in Conf . make_string " ext_dll " dflt " Default extension for dynamic library . " |
let exec fn = if Sys . os_type = " Win32 " then fn " . ^ exe " else fn |
let fn_printer ~ root fn = FilePath . make_relative root fn |
module SetFileElement = struct type t = filename let compare = if Sys . os_type = " Win32 " then OASISUtils . compare_csl else String . compare let pp_printer = Format . pp_print_string let pp_print_sep = OUnitDiff . pp_comma_separator end |
module SetFile = struct include OASISUtils . SetExt . Make ( SetFileElement ) module Diff = OUnitDiff . SetMake ( SetFileElement ) let assert_equal ? msg ~ root exp act = Diff . assert_equal ? msg ( Diff . of_list ( List . rev_map ( fn_printer ~ root ) ( elements exp ) ) ) ( Diff . of_list ( List . rev_map ( fn_printer... |
module SetFileDigestElement = struct type t = filename * Digest . t let compare ( f1 , d1 ) ( f2 , d2 ) = match SetFileElement . compare f1 f2 with | 0 -> String . compare d1 d2 | n -> n let pp_printer frmtr ( filename , digest ) = Format . fprintf frmtr " ( % S , % s ) " filename ( Digest . to_hex digest ) let pp_prin... |
module SetFileDigest = struct include OASISUtils . SetExt . Make ( SetFileDigestElement ) module Diff = OUnitDiff . SetMake ( SetFileDigestElement ) let assert_equal ? msg ~ root exp act = let convert lst = Diff . of_list ( List . rev_map ( fun ( fn , digest ) -> fn_printer ~ root fn , digest ) ( elements lst ) ) in Di... |
let all_files dir = find Is_file dir ( fun st fn -> SetFile . add fn st ) SetFile . empty |
let all_file_digests dn = SetFile . fold ( fun fn st -> SetFileDigest . add ( fn , Digest . file fn ) st ) ( all_files dn ) SetFileDigest . empty |
let check_file_style test_ctxt fn = let chn = open_in fn in let line_number = ref 0 in try while true do let line = input_line chn in incr line_number ; non_fatal test_ctxt ( fun _ -> let strlen = String . length line in if strlen > 0 && line . [ strlen - 1 ] = ' ' then if strlen = 1 || strlen > 1 && line . [ strlen - ... |
let check_all_files_style test_ctxt dn = let ocamlmod_version = try let buff = Buffer . create 10 in OUnit2 . assert_command ~ ctxt : test_ctxt ~ foutput ( : fun strm -> Stream . iter ( Buffer . add_char buff ) strm ) ( TestCommon . ocamlmod_exec test_ctxt ) [ " - version " ] ; Buffer . contents buff with _ -> " 0 . 0 ... |
type t = { is_native : bool ; native_dynlink : bool ; src_dir : filename ; build_dir : filename ; ocaml_lib_dir : filename ; bin_dir : filename ; lib_dir : filename ; data_dir : filename ; doc_dir : filename ; html_dir : filename ; precompile_dir : filename ; pristine : SetFileDigest . t ; pristine_build : SetFile . t ... |
let setup_test_directories test_ctxt ~ is_native ~ native_dynlink dn = let tmpdir = bracket_tmpdir test_ctxt in let src_dir = let tgtdir = Filename . concat tmpdir ( Filename . basename dn ) in logf test_ctxt ` Info " Copying data from % S to % S " dn tmpdir ; FileUtil . cp ~ recurse : true [ dn ] tgtdir ; tgtdir in le... |
let in_src_dir t fn = Filename . concat t . src_dir fn |
let rec precompile_setup_ml test_ctxt t = let setup_exe = exec ( Filename . concat t . precompile_dir ( Filename . chop_extension setup_ml ) ) in let full_setup_ml = in_src_dir t setup_ml in let can_compile ( ) = let chn = open_in full_setup_ml in let hash_load = ref false in let ( ) = try while not ! hash_load do if O... |
let ocaml_env ( ? extra_env [ ] ) = _ t = let local_lib_paths = find Is_dir t . lib_dir ( fun acc fn -> fn :: acc ) ( find Is_dir t . ocaml_lib_dir ( fun acc fn -> fn :: acc ) [ ] ) in let env_paths = try FilePath . path_of_string ( Unix . getenv " PATH " ) with Not_found -> [ ] in let paths , extra_paths = if Sys . os... |
let assert_command_with_ocaml_env ? extra_env ? exit_code ? chdir ? check_output test_ctxt t cmd args = let paths , extra_env = ocaml_env ? extra_env test_ctxt t in let real_cmd = try if not ( Sys . file_exists cmd ) then which ~ path : paths cmd else cmd with Not_found -> assert_failure ( Printf . sprintf " Command ' ... |
let run_ocaml_setup_ml ( ? with_ocaml_env = false ) ? exit_code ? check_output ( ? extra_env [ ] ) = test_ctxt t args = let timer = timer_start ( " run_ocaml_setup_ml " ( ^ List . hd args ) ) in let toplevel_path = try Sys . getenv " OCAML_TOPLEVEL_PATH " with Not_found -> " " in let _ , extra_env = ocaml_env ~ extra_e... |
let try_installed_exec ? exit_code test_ctxt t cmd args = assert_command_with_ocaml_env test_ctxt ? exit_code t cmd args |
let assert_compile test_ctxt t pkg cmd args = assert_command_with_ocaml_env test_ctxt t " ocamlfind " ( cmd :: " - package " :: pkg :: args ) |
let try_installed_library test_ctxt t pkg modules = let srcdir = bracket_tmpdir test_ctxt in let fn = FilePath . concat srcdir " testZZZ . ml " in let ( ) = let chn_out = open_out fn in List . iter ( Printf . fprintf chn_out " open % s ; ; \ n " ) modules ; close_out chn_out in let exec_byte = FilePath . replace_extens... |
let contains_string fn str = let rex = Pcre . regexp ( Pcre . quote str ) in let has_string = ref false in let chn = open_in fn in Pcre . foreach_line ~ ic : chn ( fun l -> if not ! has_string then has_string := Pcre . pmatch ~ rex l ) ; close_in chn ; ! has_string |
let oasis_ocamlbuild_files = [ " myocamlbuild . ml " ; " _tags " ] |
let register_generated_files t lst = List . iter ( fun fn -> t . generated_files <- SetFile . add ( in_src_dir t fn ) t . generated_files ) lst |
let check_generated_files location t = let expected_files = SetFileDigest . fold ( fun ( fn , _ ) st -> SetFile . add fn st ) t . pristine t . generated_files in SetFile . assert_equal ~ msg ( " : Generated files ( " ^ location " ) " ) ^ ~ root : t . src_dir expected_files ( all_files t . src_dir ) |
let back_to_pristine t = rm ( SetFile . elements t . generated_files ) ; SetFileDigest . assert_equal ~ msg " : Source directory back to pristine " ~ root : t . src_dir t . pristine ( all_file_digests t . src_dir ) |
type installed_files = | InstalledLibrary of filename list | InstalledOCamlLibrary of string * filename list | InstalledHTML of string * filename list | InstalledAPIRef of string * string list | InstalledData of filename list | InstalledBin of filename list |
let register_installed_files test_ctxt t installed_files_lst = let rec file_list = function | InstalledLibrary fn_lst -> List . rev_map ( FilePath . concat t . lib_dir ) fn_lst | InstalledOCamlLibrary ( lib , fn_lst ) -> List . rev_map ( fun fn -> FilePath . make_filename [ t . ocaml_lib_dir ; lib ; fn ] ) fn_lst | Ins... |
let check_installed_files _ t id = SetFile . assert_equal ~ msg ( : Printf . sprintf " Installed files ( % s ) " id ) ~ root : t . build_dir SetFile . ( union t . installed_files t . pristine_build ) ( all_files t . build_dir ) |
let check_nothing_installed _ t id = SetFile . assert_equal ~ msg ( : Printf . sprintf " Build directory is empty after uninstall ( % s ) " id ) ~ root : t . build_dir t . pristine_build ( all_files t . build_dir ) |
let check_myocamlbuild_ml test_ctxt t = if Sys . file_exists ( in_src_dir t " myocamlbuild . ml " ) then begin let timer = timer_start " check_myocamlbuild_ml " in let ( ) = dbug_file_content test_ctxt ( in_src_dir t " myocamlbuild . ml " ) in let documentation_output = let buf = Buffer . create 16000 in OUnit2 . asser... |
let check_tags test_ctxt t = if Sys . file_exists ( in_src_dir t " _tags " ) then begin let ( ) = dbug_file_content test_ctxt ( in_src_dir t " _tags " ) in let _ , lst = List . fold_right ( fun line ( lineno , lst ) -> lineno + 1 , ( lineno , line ) :: lst ) ( OASISString . nsplit ( file_content ( in_src_dir t " _tags ... |
let oasis_setup ( ? dev = false ) ( ? dynamic = false ) ( ? nocompat = false ) test_ctxt t = let ( ) = let pkg = OASISParse . from_file ~ ctxt ( : oasis_ctxt test_ctxt ) ( in_src_dir t OASISParse . default_oasis_fn ) in match pkg . OASISTypes . ocaml_version with | Some ver_cmp -> skip_if ( not ( OASISVersion . compara... |
let standard_checks test_ctxt t = let timer = timer_start " standard_checks " in check_generated_files " standard_checks " t ; check_tags test_ctxt t ; timer_stop test_ctxt timer |
let standard_test test_ctxt t = standard_checks test_ctxt t ; run_ocaml_setup_ml test_ctxt t [ " - all " ; " " ; -- " -- override " ; " is_native " ; string_of_bool t . is_native ] ; check_myocamlbuild_ml test_ctxt t ; run_ocaml_setup_ml test_ctxt t [ " - distclean " ] ; check_generated_files " after distclean " t ; ru... |
let install_oasis_library test_ctxt t = let source_dir = source_dir test_ctxt in let in_source_dir = Filename . concat source_dir in let ocamlfind_install nm meta files = let files_to_install = List . filter Sys . file_exists ( List . flatten ( List . map ( fun ( dn , lst ) -> List . map ( fun fn -> in_source_dir ( Fil... |
let yep f x = try ignore ( f x ) ; true with | _ -> false ; ; |
let tests1 = [ " " \ hello " " , \ true ; " < hello " , > true ; " < hel * lo " , > true ; " < a > and < b > or < c " , > true ; " < a > titi " , false ] ; ; |
let tests2 = [ " [ < a ] " , > [ " a " ] , [ " b " ] ; " [ < a - z ] " , > [ " a " ; " e " ; " k " ; " z " ] , [ " 0 " ; " A " ; " " ] ; ~ " [ < a - z ] [ 0 - 9 ] " , > [ " a0 " ; " b9 " ] , [ " a00 " ; " a0a " ; " b0a " ; " isduis " ; " " ] ; " < hello " , > [ " hello " ] , [ " helli " ] ; " " \ hello " " , \ [ " hell... |
let tests3 = [ " ( % path ) :<**/> lib ( % libname :<*> and not . ) . <**> a " , [ " libfoo . a " , " " , " foo " ; " src / bar / libfoo . a " , " src / bar " , " / foo " ; " otherlibs / unix / libunix . a " , " otherlibs / unix " , " / unix " ; " otherlibsliblib / unlibix / libunix . a " , " otherlibsliblib / unlibix ... |
let _ = let times = 3 in List . iter begin fun ( str , ast ) -> let ast ' = yep Glob . parse str in if ast <> ast ' then begin Printf . printf " Globexp parsing failed for % S . \ n " %! str ; exit 1 end else Printf . printf " Globexp for % S OK \ n " %! str end tests1 ; List . iter begin fun ( gstr , yes , no ) -> let... |
let tests = " Groups " >::: [ " Creating a new group " >:: ( fun test_ctxt -> let g = RTCGroup . build ( ) in assert ( RTCMatrix . equal g . transform RTCMatrix . identity ) ; assert ( RTCGroup . is_empty g ) ) ; " Adding a child to a group " >:: ( fun test_ctxt -> let s = TestShape . test_shape ( ) in let g = RTCGroup... |
type parameter_taint = { name : string ; sinks : Sinks . t list ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.