Debian Codegraph @

test/unit-tests/ocaml-config/ocaml_config_roundtrip_gh637.ml

raw symbols SCIP
1 open Stdune
2
3 let pwd = Sys.getcwd ()
4
5 let valid_ocaml_config =
6 Printf.sprintf
7 {|version: 4.02.3
8 standard_library_default: %s
9 standard_library: %s
10 standard_runtime: /usr/bin/ocamlrun
11 ccomp_type: cc
12 bytecomp_c_compiler: gcc -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O -fPIC
13 bytecomp_c_libraries: -lm -ldl -lcurses -lpthread
14 native_c_compiler: gcc -O -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
15 native_c_libraries: -lm -ldl
16 native_pack_linker: ld -r -o
17 ranlib: ranlib
18 cc_profile: -pg
19 architecture: none
20 model: default
21 system: unknown
22 asm:
23 asm_cfi_supported: false
24 with_frame_pointers: false
25 ext_obj: .o
26 ext_asm: .s
27 ext_lib: .a
28 ext_dll: .so
29 os_type: Unix
30 default_executable_name: a.out
31 systhread_supported: true
32 host: mips-unknown-linux-gnu
33 target: mips-unknown-linux-gnu
34 exec_magic_number: Caml1999X011
35 cmi_magic_number: Caml1999I017
36 cmo_magic_number: Caml1999O010
37 cma_magic_number: Caml1999A011
38 cmx_magic_number: Caml1999Y014
39 cmxa_magic_number: Caml1999Z013
40 ast_impl_magic_number: Caml1999M016
41 ast_intf_magic_number: Caml1999N015
42 cmxs_magic_number: Caml2007D002
43 cmt_magic_number: Caml2012T004|}
44 pwd
45 pwd
46 ;;
47
48 let () =
49 match
50 match valid_ocaml_config |> String.split_lines |> Ocaml_config.Vars.of_lines with
51 | Ok x -> Ocaml_config.make x
52 | Error msg -> Error (Ocamlc_config, msg)
53 with
54 | Error (_, e) -> failwith e
55 | Ok c ->
56 (* Check that [Ocaml_config.to_list] and [Ocaml_config.by_name] agree *)
57 List.iter (Ocaml_config.to_list c) ~f:(fun (name, v) ->
58 assert (Ocaml_config.by_name c name = Some v))
59 ;;