Expose a bug in the S-expression record parser
This commit is contained in:
parent
9fbfc272eb
commit
0d27e9f909
|
@ -69,3 +69,13 @@
|
|||
(progn
|
||||
(run ${exe:expect_test.exe} ${<})
|
||||
(diff? ${<} ${<}.corrected))))))
|
||||
|
||||
(alias
|
||||
((name runtest)
|
||||
(deps (sexp.mlt
|
||||
(glob_files ${SCOPE_ROOT}/src/.dune.objs/*.cmi)
|
||||
(glob_files ${SCOPE_ROOT}/src/stdune/.stdune.objs/*.cmi)))
|
||||
(action (chdir ${SCOPE_ROOT}
|
||||
(progn
|
||||
(run ${exe:expect_test.exe} ${<})
|
||||
(diff? ${<} ${<}.corrected))))))
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
(* -*- tuareg -*- *)
|
||||
open Stdune;;
|
||||
open Sexp.Of_sexp;;
|
||||
|
||||
let pp_sexp_ast ppf sexp =
|
||||
Sexp.pp ppf (Sexp.Ast.remove_locs sexp)
|
||||
;;
|
||||
#install_printer pp_sexp_ast;;
|
||||
[%%expect{|
|
||||
val pp_sexp_ast : Format.formatter -> Stdune.Sexp.Ast.t -> unit = <fun>
|
||||
|}]
|
||||
|
||||
Printexc.record_backtrace false;;
|
||||
[%%expect{|
|
||||
- : unit = ()
|
||||
|}]
|
||||
|
||||
let sexp = Sexp.parse_string ~fname:"" ~mode:Single {|
|
||||
((foo 1)
|
||||
(foo 2))
|
||||
|}
|
||||
[%%expect{|
|
||||
val sexp : Usexp.Ast.t = ((foo 1) (foo 2))
|
||||
|}]
|
||||
|
||||
let of_sexp = record (field "foo" int)
|
||||
let x = of_sexp sexp
|
||||
[%%expect{|
|
||||
val of_sexp : int Stdune.Sexp.Of_sexp.t = <fun>
|
||||
val x : int = 2
|
||||
|}]
|
Loading…
Reference in New Issue