about summary refs log tree commit diff
path: root/tvix/serde/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-06-16T12·07+0300
committerclbot <clbot@tvl.fyi>2023-06-16T12·11+0000
commita3b212b82b58e5971c70a1ad91fd2f3d775bddb5 (patch)
treef89aac9c29738b6e8bd22a81d07d47314ebd1807 /tvix/serde/src
parent3e915af8bb2ef3f9714a3697ad9ac07ac192eaad (diff)
test(tvix/serde): add a test for from_str_with_config r/6325
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
Diffstat (limited to 'tvix/serde/src')
-rw-r--r--tvix/serde/src/de_tests.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tvix/serde/src/de_tests.rs b/tvix/serde/src/de_tests.rs
index 8fe15a17e378..50a078cc0998 100644
--- a/tvix/serde/src/de_tests.rs
+++ b/tvix/serde/src/de_tests.rs
@@ -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");
+}