Add expectation test to parsing out of findlib toolchain config
This commit is contained in:
parent
5f237e3a4d
commit
623ebfc2da
|
@ -23,6 +23,7 @@
|
||||||
(deps (tests.mlt
|
(deps (tests.mlt
|
||||||
(glob_files ${SCOPE_ROOT}/src/.jbuilder.objs/*.cmi)
|
(glob_files ${SCOPE_ROOT}/src/.jbuilder.objs/*.cmi)
|
||||||
(glob_files ${SCOPE_ROOT}/src/stdune/.stdune.objs/*.cmi)
|
(glob_files ${SCOPE_ROOT}/src/stdune/.stdune.objs/*.cmi)
|
||||||
|
(files_recursively_in toolchain.d)
|
||||||
(files_recursively_in findlib-db)))
|
(files_recursively_in findlib-db)))
|
||||||
(action (chdir ${SCOPE_ROOT}
|
(action (chdir ${SCOPE_ROOT}
|
||||||
(progn
|
(progn
|
||||||
|
|
|
@ -77,3 +77,38 @@ val meta : Jbuilder.Meta.Simplified.t =
|
||||||
; subs = []
|
; 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"))
|
||||||
|
|}]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
FOO_BAR(tlc, env) = "my variable"
|
Loading…
Reference in New Issue