text stringlengths 0 601k |
|---|
let create_precision ~ sqrt2_5 ~ small_2 ~ large_2 ( ) : precision = { sqrt2_5 = sqrt2_5 ; small_2 = small_2 ; large_2 = large_2 ; } |
let create_generic ~ x294623 ( ) : ' a generic = { x294623 = x294623 ; } |
let create_floats ~ f32 ~ f64 ( ) : floats = { f32 = f32 ; f64 = f64 ; } |
let create_extended ~ b0x ~ b1x ~ b2x ? b3x ~ b4x ( ? b5x = 0 . 5 ) ( ) : extended = { b0x = b0x ; b1x = b1x ; b2x = b2x ; b3x = b3x ; b4x = b4x ; b5x = b5x ; } |
let create_base ~ b0 ~ b1 ( ) : base = { b0 = b0 ; b1 = b1 ; } |
let tests_url = List . map ( fun txt -> test_case ( fun test_ctxt -> let _a = url . parse ~ ctxt ( : oasis_ctxt test_ctxt ) txt in ( ) ) ) [ " https :// oasis . forge . ocamlcore . org " ; " svn :// scm . ocamlcore . org / svnroot / cryptokit / tags " ; " svn + ssh :// scm . ocamlcore . org / svnroot / cryptokit / tags... |
let tests_command_line_options = List . map ( fun ( s , r ) -> ( sprintf " command_line_options : % S " s ) >:: ( fun test_ctxt -> let p = command_line_options . parse ~ ctxt ( : oasis_ctxt test_ctxt ) s in assert_equal p r ) ) [ " " , [ ] ; " a " , [ " a " ] ; " a b " , [ " a " ; " b " ] ; " a b c " , [ " a " ; " b " ... |
let tests_posix_quoting = List . map ( fun s -> ( sprintf " OASISUtils . POSIXShell : % S " s ) >:: ( fun _ -> let q = OASISUtils . POSIXShell . escape s in let u = if q . [ 0 ] = ' " ' then let q ' = String . sub q 1 ( String . length q - 2 ) in OASISUtils . POSIXShell . unescape q ' else q in assert_equal s u ) ) [ "... |
let tests = " Values " >::: ( tests_url @ tests_command_line_options @ tests_posix_quoting ) |
let tests = let vstr_compare v1 v2 = version_compare ( version_of_string v1 ) ( version_of_string v2 ) in let version_compare_of_vector ( v1 , v2 , exp ) = ( Printf . sprintf " version_compare % S % S " v1 v2 ) >:: ( fun test_ctxt -> let norm_sign i = if i = 0 then 0 else if i < 0 then - 1 else 1 in assert_equal ~ msg ... |
let test_of_vector ( tarballs , urls ) = ( String . concat " " + urls ) >:: TestCLI . bracket_oasis_db_cli ( fun ocs oasis_cli -> ODBCurl . with_curl ( fun curl -> let write_fun str = if ! verbose then prerr_string str ; String . length str in assert_command oasis_cli [ " update " ] ; List . iter ( fun tarball -> asser... |
let tests = " Web " >::: ( List . map test_of_vector [ [ " batteries - 2 . 0beta . tar . gz " ] , [ " view / batteries / 2 . 0beta " ] ; [ " oasis - 0 . 2 . 0 . tar . gz " ; " bin_prot - 1 . 3 . 1 . tar . gz " ] , [ " dist " ] ; / ] ) |
let r2d2 = r2 . / 2 . |
let default_world ( ) = let s1 = RTCSphere . build ( ) in let m1 = RTCMaterial . build ~ color ( : RTCColor . build 0 . 8 1 . 0 0 . 6 ) ~ diffuse : 0 . 7 ~ specular : 0 . 2 ( ) in let s1 ' = RTCShape . texture s1 m1 in let s2 = RTCSphere . build ( ) in let s2 ' = RTCShape . transform s2 ( RTCTransform . scaling 0 . 5 0... |
let tests = " World " >::: [ " Creating a world " >:: ( fun test_ctxt -> let w = RTCWorld . build ( ) in assert_equal 0 ( List . length w . shapes ) ; assert_equal 0 ( List . length w . lights ) ) ; " The default world " >:: ( fun test_ctxt -> let light = RTCLight . point ( RTCTuple . point ( - 10 . ) 10 . ( - 10 . ) )... |
* hassysthreads include systhreads ** not - windows *** bytecode *** native ) * |
let are_ready = ref 0 |
let yields = ref 0 |
let last = ref ( - 1 ) |
let report thread run_length = if run_length > 3 then Printf . printf " Thread % d ran % d consecutive iters \ n " thread run_length |
let threads = List . init threads ( Thread . create ( fun i -> incr are_ready ; while ! are_ready < threads do Thread . yield ( ) done ; let consecutive = ref 0 in while ! yields < iters do incr yields ; last := i ; Thread . yield ( ) ; incr consecutive ; if not ( ! last = i ) then ( report i ! consecutive ; consecutiv... |
let suite_of : type a . ( string option -> a ) -> a Alcotest . testable -> ( string * a ) list -> _ list = fun pf t -> List . map ( fun ( s , expected ) -> let test ( ) = Alcotest . check t s ( pf ( Some s ) ) expected in ( s , ` Quick , test ) ) |
let suite_of_fail : type a . ( string option -> a ) -> a Alcotest . testable -> ( string * exn ) list -> _ list = fun pf _ -> List . map ( fun ( s , e ) -> let test ( ) = Alcotest . check_raises s e ( fun ( ) -> ignore ( pf ( Some s ) ) ) in ( s , ` Quick , test ) ) |
let suite_to_string_of : type a . ( a -> string ) -> ( a * string ) list -> _ list = fun pf -> List . map ( fun ( v , expected_str ) -> let test ( ) = Alcotest . ( check string expected_str expected_str ( pf v ) ) in ( expected_str , ` Quick , test ) ) |
let suite_to_string_of_fail : type a . ( a -> string ) -> ( a * string * exn ) list -> _ list = fun pf -> List . map ( fun ( v , descr , e ) -> let test ( ) = Alcotest . ( check_raises descr e ( fun ( ) -> ignore ( pf v ) ) ) in ( " " , ` Quick , test ) ) |
let valid_media_ranges = [ ( " text / plain " , [ ( 1000 , ( A . MediaType ( " text " , " plain " ) , [ ] ) ) ] ) ; ( " text " , /* [ ( 1000 , ( A . AnyMediaSubtype " text " , [ ] ) ) ] ) ; ( " " , */* [ ( 1000 , ( A . AnyMedia , [ ] ) ) ] ) ; ( " ; */* q = 1 " , [ ( 1000 , ( A . AnyMedia , [ ] ) ) ] ) ; ( " ; */* q = ... |
let invalid_media_ranges = [ ( " ; */* q . " , = Parsing . Parse_error ) ] |
let valid_media_ranges_suite = let t_media_ranges = Alcotest . testable ( Fmt . of_to_string A . string_of_media_ranges ) ( = ) in suite_of A . media_ranges t_media_ranges valid_media_ranges |
let invalid_media_ranges_suite = let t_media_ranges = Alcotest . testable ( Fmt . of_to_string A . string_of_media_ranges ) ( = ) in suite_of_fail A . media_ranges t_media_ranges invalid_media_ranges |
let valid_qualities = [ ( ( 1000 , ( A . AnyMedia , [ ] ) ) , " ; */* q = 1 " ) ; ( ( 0 , ( A . AnyMedia , [ ] ) ) , " ; */* q = 0 . 000 " ) ; ( ( 353 , ( A . AnyMedia , [ ] ) ) , " ; */* q = 0 . 353 " ) ; ( ( 25 , ( A . AnyMedia , [ ] ) ) , " ; */* q = 0 . 025 " ) ; ( ( 1 , ( A . AnyMedia , [ ] ) ) , " ; */* q = 0 . 0... |
let invalid_qualities = [ ( ( - 3 , ( A . AnyMedia , [ ] ) ) , " negative " , Invalid_argument " qvalue - 3 must be positive " ) ; ( ( 1001 , ( A . AnyMedia , [ ] ) ) , " bigger than 1000 " , Invalid_argument " qvalue 1001 must be less than 1000 " ) ; ] |
let valid_qualities_suite = suite_to_string_of ( fun ( q , a ) -> A . string_of_media_range a q ) valid_qualities |
let invalid_qualities_suite = suite_to_string_of_fail ( fun ( q , a ) -> A . string_of_media_range a q ) invalid_qualities |
let valid_charsets = [ ( " utf - 8 " , [ ( 1000 , A . Charset " utf - 8 " ) ] ) ; ( " UTF - 8 " , [ ( 1000 , A . Charset " utf - 8 " ) ] ) ; ( " iso - 8859 - 1 " , [ ( 1000 , A . Charset " iso - 8859 - 1 " ) ] ) ; ( " ISO - 8859 - 1 ; q = 0 . 8 , ; * q = 0 . 7 " , [ ( 800 , A . Charset " iso - 8859 - 1 " ) ; ( 700 , A ... |
let valid_charsets_suite = let t_charsets = Alcotest . testable ( Fmt . of_to_string A . string_of_charsets ) ( = ) in suite_of A . charsets t_charsets valid_charsets |
let valid_encodings = [ ( " compress , gzip " , [ ( 1000 , A . Compress ) ; ( 1000 , A . Gzip ) ] ) ; ( " " , [ ] ) ; ( " " , * [ ( 1000 , A . AnyEncoding ) ] ) ; ( " compress ; q = 0 . 5 , gzip ; q = 1 . 0 " , [ ( 500 , A . Compress ) ; ( 1000 , A . Gzip ) ] ) ; ( " Gzip ; q = 1 . 0 , identity ; q = 0 . 5 , ; * q = 0 ... |
let valid_encodings_suite = let t_encodings = Alcotest . testable ( Fmt . of_to_string A . string_of_encodings ) ( = ) in suite_of A . encodings t_encodings valid_encodings |
let valid_languages = [ ( " en " , [ ( 1000 , A . Language [ " en " ] ) ] ) ; ( " en - US " , [ ( 1000 , A . Language [ " en " ; " us " ] ) ] ) ; ( " en - cockney " , [ ( 1000 , A . Language [ " en " ; " cockney " ] ) ] ) ; ( " i - cherokee " , [ ( 1000 , A . Language [ " i " ; " cherokee " ] ) ] ) ; ( " x - pig - lati... |
let valid_languages_suite = let t_languages = Alcotest . testable ( Fmt . of_to_string A . string_of_languages ) ( = ) in suite_of A . languages t_languages valid_languages |
let ( ) = Printexc . record_backtrace true |
let ( ) = Alcotest . run " test_accept " [ ( " valid string to media range " , valid_media_ranges_suite ) ; ( " invalid string to media range " , invalid_media_ranges_suite ) ; ( " valid media range to string " , valid_qualities_suite ) ; ( " invalid media range to string " , invalid_qualities_suite ) ; ( " valid strin... |
let commitments = List . map ( fun ( bpkh , a ) -> Commitment . { blinded_public_key_hash = Blinded_public_key_hash . of_b58check_exn bpkh ; amount = Tez . of_mutez_exn ( Int64 . of_string a ) ; } ) [ ( " btz1bRL4X5BWo2Fj4EsBdUwexXqgTf75uf1qa " , " 23932454669343 " ) ; ( " btz1SxjV1syBgftgKy721czKi3arVkVwYUFSv " , " 72... |
type secret_account = { account : public_key_hash ; activation_code : Blinded_public_key_hash . activation_code ; amount : Tez . t ; } |
let secrets ( ) = let read_key mnemonic email password = match Tezos_client_base . Bip39 . of_words mnemonic with | None -> assert false | Some t -> let passphrase = Bytes . ( cat ( of_string email ) ( of_string password ) ) in let sk = Tezos_client_base . Bip39 . to_seed ~ passphrase t in let sk = Bytes . sub sk 0 32 ... |
let activation_init ( ) = Context . init ~ consensus_threshold : 0 ~ commitments 1 >|=? fun ( b , cs ) -> secrets ( ) |> fun ss -> ( b , cs , ss ) |
let test_simple_init_with_commitments ( ) = activation_init ( ) >>=? fun ( blk , _contracts , _secrets ) -> Block . bake blk >>=? fun _ -> return_unit |
let test_single_activation ( ) = activation_init ( ) >>=? fun ( blk , _contracts , secrets ) -> let ( { account ; activation_code ; amount = expected_amount ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in Assert . balance_is ~ loc : __LOC__ ( B blk ) ( Contract . implicit_c... |
let test_multi_activation_1 ( ) = activation_init ( ) >>=? fun ( blk , _contracts , secrets ) -> List . fold_left_es ( fun blk { account ; activation_code ; amount = expected_amount ; _ } -> Op . activation ( B blk ) account activation_code >>=? fun operation -> Block . bake ~ operation blk >>=? fun blk -> Assert . bal... |
let test_multi_activation_2 ( ) = activation_init ( ) >>=? fun ( blk , _contracts , secrets ) -> List . fold_left_es ( fun ops { account ; activation_code ; _ } -> Op . activation ( B blk ) account activation_code >|=? fun op -> op :: ops ) [ ] secrets >>=? fun ops -> Block . bake ~ operations : ops blk >>=? fun blk ->... |
let test_activation_and_transfer ( ) = activation_init ( ) >>=? fun ( blk , contracts , secrets ) -> let ( { account ; activation_code ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in let bootstrap_contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd contrac... |
let test_transfer_to_unactivated_then_activate ( ) = activation_init ( ) >>=? fun ( blk , contracts , secrets ) -> let ( { account ; activation_code ; amount } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in let bootstrap_contract = WithExceptions . Option . get ~ loc : __LOC__ @... |
let test_invalid_activation_with_no_commitments ( ) = Context . init 1 >>=? fun ( blk , _ ) -> let secrets = secrets ( ) in let ( { account ; activation_code ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in Op . activation ( B blk ) account activation_code >>=? fun operation... |
let test_invalid_activation_wrong_secret ( ) = activation_init ( ) >>=? fun ( blk , _ , secrets ) -> let ( { account ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth secrets 0 in let ( { activation_code ; _ } as _second_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . n... |
let test_invalid_activation_inexistent_pkh ( ) = activation_init ( ) >>=? fun ( blk , _ , secrets ) -> let ( { activation_code ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in let inexistent_pkh = Signature . Public_key_hash . of_b58check_exn " tz1PeQHGKPWSpNoozvxgqLN9TFsj6r... |
let test_invalid_double_activation ( ) = activation_init ( ) >>=? fun ( blk , _ , secrets ) -> let ( { account ; activation_code ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in Incremental . begin_construction blk >>=? fun inc -> Op . activation ( I inc ) account activation... |
let test_invalid_transfer_from_unactivated_account ( ) = activation_init ( ) >>=? fun ( blk , contracts , secrets ) -> let ( { account ; _ } as _first_one ) = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd secrets in let bootstrap_contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd contrac... |
let tests = [ Tztest . tztest " init with commitments " ` Quick test_simple_init_with_commitments ; Tztest . tztest " single activation " ` Quick test_single_activation ; Tztest . tztest " multi - activation one - by - one " ` Quick test_multi_activation_1 ; Tztest . tztest " multi - activation all at a time " ` Quick ... |
let test_function = " test - function " |> Symbol . intern |
let initialize ( ) = defun test_function [ % here ] ~ docstring " :< docstring " > ( Returns Value . Type . int ) ( let open Defun . Let_syntax in let % map_open args = rest " rest " value in print_s [ % message " test - function " ( args : Value . t list ) ] ; 13 ) ; ; |
let call_test_function ( ) = let result = Symbol . funcall1 test_function ( Value . of_int_exn 1 ) in print_s [ % message " call " ( result : Value . t ) ] ; ; |
let advice_name = " test - advice " |> Symbol . intern initialize ( ) ; let t = Advice . defun_around_values advice_name [ % here ] ~ docstring " :< docstring " > Sync ( fun inner rest -> print_s [ % message " advice " ( rest : Value . t list ) ] ; let inner_result = inner ( ( 0 |> Value . of_int_exn ) :: rest ) in pri... |
let test_primitive_alignment _ = begin assert_equal ~ msg " : alignmentof ( char ) == 1 " ( alignment char ) 1 ; assert_equal ~ msg " : alignmentof ( signed char ) == 1 " ( alignment schar ) 1 ; assert_equal ~ msg " : alignmentof ( unsigned char ) == 1 " ( alignment uchar ) 1 ; assert_equal ~ msg " : alignmentof ( shor... |
let test_abstract_alignment _ = for i = 1 to 10 do assert_equal i ( alignment ( abstract ~ name " : abstract " ~ size ( : 11 - i ) ~ alignment : i ) ) done |
let test_incomplete_alignment _ = assert_raises IncompleteType ( fun ( ) -> alignment void ) ; let module M = struct let t = structure " t " let i = field t " i " int let ( ) = assert_raises IncompleteType ( fun ( ) -> alignment t ) end in let module M = struct let u = union " u " let i = field u " i " int let ( ) = as... |
let test_alignment_ocaml_string _ = assert_raises IncompleteType ( fun ( ) -> alignment ocaml_string ) |
let test_struct_alignment _ = let module M = struct type a and b and u let maximum = List . fold_left max 0 let struct_a = structure " A " let ( ) -: ty label = field struct_a label ty let _ = char -: " _ " let _ = int -: " _ " let _ = double -: " _ " let ( ) = seal struct_a let ( ) = assert_equal ( maximum [ alignment... |
let test_struct_tail_padding _ = let module M = struct type a and b and u let struct_a = structure " A " let ( ) -: ty label = field struct_a label ty let a = char -: " a " let b = int -: " b " let c = char -: " c " let ( ) = seal ( struct_a : a structure typ ) let u = union " U " let ( ) -: ty label = field u label ty... |
let test_bigarray_alignment _ = let module M = struct module B = Bigarray_compat type k = K : ( ' a , ' b ) Bigarray_compat . kind * int -> k let kind_alignments = [ K ( B . float32 , alignment float ) ; K ( B . float64 , alignment double ) ; K ( B . int8_signed , alignment int8_t ) ; K ( B . int8_unsigned , alignment ... |
let suite = " Alignment tests " >::: [ " struct tail padding " >:: test_struct_tail_padding ; " primitive alignment " >:: test_primitive_alignment ; " struct alignment " >:: test_struct_alignment ; " alignment of abstract types " >:: test_abstract_alignment ; " alignment of incomplete types " >:: test_incomplete_alignm... |
let _ = run_test_tt_main suite |
module Allow_extra_fields = struct type t = { a : int } [ @@ sexp . allow_extra_fields ] [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . generic_... |
module Forbid_extra_fields = struct type t = { a : int } [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . generic_group ) = { implicit_vars = [ " ... |
module Variant_type = struct type t = | Allow_extra_fields of { foo : int } [ @ sexp . allow_extra_fields ] | Forbid_extra_fields of { bar : int } [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : P... |
let create ( ) = let accounts = Account . generate_accounts 1 in Block . alpha_context accounts |
module Test_Script = struct let test_force_bytes_in_context ( ) = create ( ) >>=? fun alpha_context -> let mbytes_pp ppf t = Format . pp_print_string ppf ( Environment . Bytes . to_string t ) in let open Alpha_context . Script in Environment . wrap_tzresult @@ force_bytes_in_context alpha_context @@ lazy_expr @@ Michel... |
module Test_Big_map = struct let test_mem ( ) = ( create ( ) >>=? fun alpha_context -> Big_map . fresh ~ temporary : true alpha_context >|= Environment . wrap_tzresult >>=? fun ( alpha_context , big_map_id ) -> Big_map . mem alpha_context big_map_id ( Script_expr_hash . hash_string [ " 0 " ; " 0 " ] ) >|= Environment .... |
let tests = [ Tztest . tztest " Script . force_bytes_in_context : checks if it serialises a simple \ michelson expression " ` Quick Test_Script . test_force_bytes_in_context ; Tztest . tztest " Big_map . mem : failure case - must return false when starting with an \ empty map " ` Quick Test_Big_map . test_mem ; Tztest ... |
let write_ambiguous ' : _ -> ambiguous ' -> _ = ( Atdgen_runtime . Oj_run . write_with_adapter Json_adapters . Identity . restore ( fun ob ( x : ambiguous ' ) -> Bi_outbuf . add_char ob ' { ' ; let is_first = ref true in if ! is_first then is_first := false else Bi_outbuf . add_char ob ' , ' ; Bi_outbuf . add_string ob... |
let string_of_ambiguous ' ( ? len = 1024 ) x = let ob = Bi_outbuf . create len in write_ambiguous ' ob x ; Bi_outbuf . contents ob |
let read_ambiguous ' = ( Atdgen_runtime . Oj_run . read_with_adapter Json_adapters . Identity . normalize ( fun p lb -> Yojson . Safe . read_space p lb ; Yojson . Safe . read_lcurl p lb ; let field_ambiguous = ref ( None ) in let field_not_ambiguous2 = ref ( None ) in try Yojson . Safe . read_space p lb ; Yojson . Safe... |
let ambiguous ' _of_string s = read_ambiguous ' ( Yojson . Safe . init_lexer ( ) ) ( Lexing . from_string s ) |
let write_ambiguous : _ -> ambiguous -> _ = ( fun ob ( x : ambiguous ) -> Bi_outbuf . add_char ob ' { ' ; let is_first = ref true in if ! is_first then is_first := false else Bi_outbuf . add_char ob ' , ' ; Bi_outbuf . add_string ob " " \ ambiguous " " ; \: ( Yojson . Safe . write_string ) ob x . ambiguous ; if ! is_fi... |
let string_of_ambiguous ( ? len = 1024 ) x = let ob = Bi_outbuf . create len in write_ambiguous ob x ; Bi_outbuf . contents ob |
let read_ambiguous = ( fun p lb -> Yojson . Safe . read_space p lb ; Yojson . Safe . read_lcurl p lb ; let field_ambiguous = ref ( None ) in let field_not_ambiguous1 = ref ( None ) in try Yojson . Safe . read_space p lb ; Yojson . Safe . read_object_end lb ; Yojson . Safe . read_space p lb ; let f = fun s pos len -> if... |
let ambiguous_of_string s = read_ambiguous ( Yojson . Safe . init_lexer ( ) ) ( Lexing . from_string s ) |
let create_ambiguous ' ~ ambiguous ~ not_ambiguous2 ( ) : ambiguous ' = { ambiguous = ambiguous ; not_ambiguous2 = not_ambiguous2 ; } |
let create_ambiguous ~ ambiguous ~ not_ambiguous1 ( ) : ambiguous = { ambiguous = ambiguous ; not_ambiguous1 = not_ambiguous1 ; } |
let ( ) = Logs . ( set_level ( Some Info ) ) ; Logs . set_reporter @@ Logs_fmt . reporter ( ) |
module Analysis = struct include Ocaml_ci . Analyse . Analysis type ocamlformat_source = Ocaml_ci . Analyse_ocamlformat . source = | Opam of { version : string } | Vendored of { path : string } [ @@ deriving yojson , eq ] let set_equality = Alcotest . ( equal ( slist string String . compare ) ) type selection = { ocaml... |
let unwrap_result ~ job = function | Ok x -> x | Error ( ` Msg m ) -> print_endline " --- job log " ; --- let id = Current . Job . id job in begin match Current . Job . log_path id with | Error ( ` Msg m ) -> print_endline m | Ok path -> let ch = open_in_bin ( Fpath . to_string path ) in let len = in_channel_length ch ... |
let error_t = Alcotest . of_pp ( fun f ( ` Msg m ) -> Fmt . string f m ) |
let expect_test name ~ project ~ expected = Alcotest_lwt . test_case name ` Quick ( fun _switch ( ) -> let ( // ) = Filename . concat in let root = Filename . current_dir_name // " _test " // name // " src " in let solver_dir = Filename . current_dir_name // " _test " // name in let repo = solver_dir // " opam - reposi... |
let duniverse = let open Gen_project in Folder ( " duniverse " , [ Folder ( " alcotest . 0 . 8 . 5 " , [ File ( " alcotest . opam " , opam ) ] ) ] ) |
let test_simple = let project = let open Gen_project in [ File ( " example . opam " , opam ) ; File ( " . ocamlformat " , ocamlformat ~ version " : 0 . 12 " ) ; ] in let expected = let open Analysis in Ok { opam_files = [ " example . opam " ] ; selection_type = " opam " ; selections = [ { ocaml_version = " 4 . 10 " ; o... |
let test_multiple_opam = let project = let open Gen_project in [ File ( " example . opam " , opam ) ; File ( " example - foo . opam " , opam ) ; File ( " example - bar . opam " , opam ) ; Folder ( " test " , [ File ( " ignored . opam " , opam ) ; Folder ( " vendored " , [ duniverse ] ) ; ] ) ; ] in let expected = let o... |
let test_filter_packages = let project = let open Gen_project in [ File ( " example . opam " , opam ) ; File ( " example - new . opam " , opam ~ ocaml { { :| >= " 4 . 10 " } } ) ; | ] in let expected = let open Analysis in Ok { opam_files = [ " example - new . opam " ; " example . opam " ] ; selection_type = " opam " ;... |
let test_filter_packages_no_solution = let project = let open Gen_project in [ File ( " example . opam " , opam ) ; File ( " example - new . opam " , opam ~ ocaml { { :| >= " 5 . 0 " } } ) ; | ] in let expected = Error ( ` Msg { | No solution found for " example - new . dev " on any supported platform } ) | in expect_t... |
let test_opam_monorepo = let project = let open Gen_project in [ File ( " example . opam " , opam_monorepo_spec_file ) ; File ( " example . opam . locked " , opam_monorepo_lock_file ~ monorepo_version ( : Some " 0 . 1 " ) ) ; File ( " dune - project " , empty_file ) ; ] in let expected = let open Analysis in Ok { opam_... |
let test_opam_monorepo_no_version = let project = let open Gen_project in [ File ( " example . opam " , opam_monorepo_spec_file ) ; File ( " example . opam . locked " , opam_monorepo_lock_file ~ monorepo_version : None ) ; File ( " dune - project " , empty_file ) ; ] in let expected = let open Analysis in Ok { opam_fil... |
let test_ocamlformat_self = let project = let open Gen_project in [ File ( " ocamlformat . opam " , opam ) ; File ( " . ocamlformat " , empty_file ) ] in let expected = let open Analysis in Ok { opam_files = [ " ocamlformat . opam " ] ; selection_type = " opam " ; selections = [ { ocaml_version = " 4 . 10 " ; only_pack... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.