about summary refs log tree commit diff
path: root/tvix/cli
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/cli')
-rw-r--r--tvix/cli/tests/repl.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tvix/cli/tests/repl.rs b/tvix/cli/tests/repl.rs
index 8d49e7771db3..a14f4bff7e6a 100644
--- a/tvix/cli/tests/repl.rs
+++ b/tvix/cli/tests/repl.rs
@@ -25,3 +25,45 @@ test_repl!(simple_expr_eval() {
         => 1 :: int
     "#]];
 });
+
+test_repl!(multiline_input() {
+    "{ x = 1; " => expect![[""]];
+    "y = 2; }" => expect![[r#"
+        => { x = 1; y = 2; } :: set
+    "#]];
+});
+
+test_repl!(bind_literal() {
+    "x = 1" => expect![[""]];
+    "x" => expect![[r#"
+        => 1 :: int
+    "#]];
+});
+
+test_repl!(bind_lazy() {
+    "x = { z = 1; }" => expect![[""]];
+    "x" => expect![[r#"
+        => { z = 1; } :: set
+    "#]];
+    "x.z" => expect![[r#"
+        => 1 :: int
+    "#]];
+    "x.z" => expect![[r#"
+        => 1 :: int
+    "#]];
+});
+
+test_repl!(deep_print() {
+    "builtins.map (x: x + 1) [ 1 2 3 ]" => expect![[r#"
+        => [ <CODE> <CODE> <CODE> ] :: list
+    "#]];
+    ":p builtins.map (x: x + 1) [ 1 2 3 ]" => expect![[r#"
+        => [ 2 3 4 ] :: list
+    "#]];
+});
+
+test_repl!(explain() {
+    ":d { x = 1; y = [ 2 3 4 ]; }" => expect![[r#"
+        => a 2-item attribute set
+    "#]];
+});