about summary refs log tree commit diff
path: root/tvix/castore/src/proto/tests/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore/src/proto/tests/mod.rs')
-rw-r--r--tvix/castore/src/proto/tests/mod.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tvix/castore/src/proto/tests/mod.rs b/tvix/castore/src/proto/tests/mod.rs
index 74334029e84c..8efb92870374 100644
--- a/tvix/castore/src/proto/tests/mod.rs
+++ b/tvix/castore/src/proto/tests/mod.rs
@@ -1 +1,30 @@
+use super::{node, Node, SymlinkNode};
+
 mod directory;
+
+/// Create a node with an empty symlink target, and ensure it fails validation.
+#[test]
+fn convert_symlink_empty_target_invalid() {
+    Node {
+        node: Some(node::Node::Symlink(SymlinkNode {
+            name: "foo".into(),
+            target: "".into(),
+        })),
+    }
+    .into_name_and_node()
+    .expect_err("must fail validation");
+}
+
+/// Create a node with a symlink target including null bytes, and ensure it
+/// fails validation.
+#[test]
+fn convert_symlink_target_null_byte_invalid() {
+    Node {
+        node: Some(node::Node::Symlink(SymlinkNode {
+            name: "foo".into(),
+            target: "foo\0".into(),
+        })),
+    }
+    .into_name_and_node()
+    .expect_err("must fail validation");
+}