Add expectation test to parsing out of findlib toolchain config

This commit is contained in:
Rudi Grinberg 2018-05-01 19:38:01 +07:00
parent 5f237e3a4d
commit 623ebfc2da
3 changed files with 37 additions and 0 deletions

View File

@ -23,6 +23,7 @@
(deps (tests.mlt
(glob_files ${SCOPE_ROOT}/src/.jbuilder.objs/*.cmi)
(glob_files ${SCOPE_ROOT}/src/stdune/.stdune.objs/*.cmi)
(files_recursively_in toolchain.d)
(files_recursively_in findlib-db)))
(action (chdir ${SCOPE_ROOT}
(progn

View File

@ -77,3 +77,38 @@ val meta : Jbuilder.Meta.Simplified.t =
; subs = []
}
|}]
#install_printer Findlib.Config.pp;;
let conf =
Findlib.Config.load (Path.of_string "test/unit-tests/toolchain")
~toolchain:"tlc" ~context:"<context>"
[%%expect{|
val conf : Jbuilder.Findlib.Config.t =
{ vars =
[ (FOO_BAR, { set_rules =
[ { preds_required = [ "tlc"; "env" ]
; preds_forbidden = []
; value = "my variable"
}
]
; add_rules = []
})
]
; preds = [ "tlc" ]
}
|}]
let env_pp fmt env = Sexp.pp fmt (Env.sexp_of_t env);;
#install_printer env_pp;;
[%%expect{|
val env_pp : Format.formatter -> Jbuilder.Env.t -> unit = <fun>
|}]
let env = Findlib.Config.env conf
[%%expect{|
val env : Jbuilder.Env.t = ((FOO_BAR "my variable"))
|}]

View File

@ -0,0 +1 @@
FOO_BAR(tlc, env) = "my variable"