65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
(* -*- tuareg -*- *)
|
|
open Dune;;
|
|
open Stdune;;
|
|
|
|
let sexp_pp = Dsexp.pp Dune;;
|
|
#install_printer Dune_file.Mode_conf.pp;;
|
|
#install_printer Binary_kind.pp;;
|
|
#install_printer sexp_pp;;
|
|
|
|
(* Dune_file.Executables.Link_mode.dparse *)
|
|
let test s =
|
|
Dsexp.Of_sexp.parse Dune_file.Executables.Link_mode.dparse Univ_map.empty
|
|
(Dsexp.parse_string ~fname:"" ~mode:Dsexp.Parser.Mode.Single s)
|
|
[%%expect{|
|
|
val sexp_pp : Format.formatter -> Usexp.t -> unit = <fun>
|
|
val test : string -> Dune_file.Executables.Link_mode.t = <fun>
|
|
|}]
|
|
|
|
(* Link modes can be read as a (<mode> <kind>) list *)
|
|
test "(best exe)"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = exe}
|
|
|}]
|
|
|
|
(* Some shortcuts also exist *)
|
|
test "exe"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = exe}
|
|
|}]
|
|
test "object"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = object}
|
|
|}]
|
|
test "shared_object"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = shared_object}
|
|
|}]
|
|
test "byte"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = byte; kind = exe}
|
|
|}]
|
|
test "native"
|
|
[%%expect{|
|
|
- : Dune_file.Executables.Link_mode.t = {mode = native; kind = exe}
|
|
|}]
|
|
|
|
(* Dune_file.Executables.Link_mode.dgen *)
|
|
let test l =
|
|
Dune_file.Executables.Link_mode.dgen l
|
|
[%%expect{|
|
|
val test : Dune_file.Executables.Link_mode.t -> Usexp.t = <fun>
|
|
|}]
|
|
|
|
(* In the general case, modes are serialized as a list *)
|
|
test {Dune_file.Executables.Link_mode.kind = Shared_object; mode = Byte }
|
|
[%%expect{|
|
|
- : Usexp.t = (byte shared_object)
|
|
|}]
|
|
|
|
(* But the specialized ones are serialized in the minimal version *)
|
|
test Dune_file.Executables.Link_mode.exe
|
|
[%%expect{|
|
|
- : Usexp.t = exe
|
|
|}]
|