test(tvix/serde): add a test for from_str_with_config

Change-Id: I451851f4e01cb6dd0005e55bb852823b618f2ee6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8809
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-06-16 15:07:29 +03:00 committed by clbot
parent 3e915af8bb
commit a3b212b82b

View file

@ -1,7 +1,7 @@
use serde::Deserialize;
use std::collections::HashMap;
use crate::de::from_str;
use crate::de::{from_str, from_str_with_config};
#[test]
fn deserialize_none() {
@ -198,3 +198,14 @@ fn deserialize_enum_all() {
assert_eq!(result, expected);
}
#[test]
fn deserialize_with_config() {
let result: String = from_str_with_config("builtins.testWithConfig", |eval| {
// Add a literal string builtin that just returns `"ok"`.
eval.src_builtins.push(("testWithConfig", "\"ok\""));
})
.expect("should deserialize");
assert_eq!(result, "ok");
}