about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-26T06·44+0300
committerflokli <flokli@flokli.de>2024-06-26T11·17+0000
commit50150fa3c8518d5b55dc6ccdeb365fb5f1e34ae0 (patch)
tree97a3f9da18c49d0353fa1f83b408529ce1dd6214 /tvix
parent89361b2a7fb33102f8a953c3f47b863210ba4eb0 (diff)
feat(tvix/glue): add eval-fail-* support to glue tests r/8311
Add some eval-fail-fetcht-*.nix test cases.

Change-Id: Ic02beabf120d1de8df6f9c098d5a074127069f81
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11880
Tested-by: BuildkiteCI
Reviewed-by: Simon Hauser <simon.hauser@helsinki-systems.de>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/glue/src/tests/mod.rs8
-rw-r--r--tvix/glue/src/tests/tvix_tests/eval-fail-fetchtarball-invalid-url.nix1
-rw-r--r--tvix/glue/src/tests/tvix_tests/eval-fail-fetchurl-invalid-url.nix1
3 files changed, 10 insertions, 0 deletions
diff --git a/tvix/glue/src/tests/mod.rs b/tvix/glue/src/tests/mod.rs
index 9fe0c222709a..5b474be73657 100644
--- a/tvix/glue/src/tests/mod.rs
+++ b/tvix/glue/src/tests/mod.rs
@@ -145,3 +145,11 @@ fn nix_eval_okay(#[files("src/tests/nix_tests/eval-okay-*.nix")] code_path: Path
 // ) {
 //     eval_test(code_path, false)
 // }
+
+// eval-fail-* tests contain a snippet of Nix code, which is
+// expected to fail evaluation.  The exact type of failure
+// (assertion, parse error, etc) is not currently checked.
+#[rstest]
+fn eval_fail(#[files("src/tests/tvix_tests/eval-fail-*.nix")] code_path: PathBuf) {
+    eval_test(code_path, false)
+}
diff --git a/tvix/glue/src/tests/tvix_tests/eval-fail-fetchtarball-invalid-url.nix b/tvix/glue/src/tests/tvix_tests/eval-fail-fetchtarball-invalid-url.nix
new file mode 100644
index 000000000000..32596ddcd5fb
--- /dev/null
+++ b/tvix/glue/src/tests/tvix_tests/eval-fail-fetchtarball-invalid-url.nix
@@ -0,0 +1 @@
+(builtins.fetchTarball /dev/null)
diff --git a/tvix/glue/src/tests/tvix_tests/eval-fail-fetchurl-invalid-url.nix b/tvix/glue/src/tests/tvix_tests/eval-fail-fetchurl-invalid-url.nix
new file mode 100644
index 000000000000..dc3f70b998d3
--- /dev/null
+++ b/tvix/glue/src/tests/tvix_tests/eval-fail-fetchurl-invalid-url.nix
@@ -0,0 +1 @@
+(builtins.fetchurl /dev/null)