about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-10-15T13·17+0300
committerflokli <flokli@flokli.de>2024-10-15T18·16+0000
commitbaebe29bab5d02607b7811dbc2542f708aee2665 (patch)
tree18f41f38287ddfe332a24e134f518f9b99215f19 /tvix
parent457decb7905665879bd2acaf2c3807be98131bc0 (diff)
test(tvix/glue): improve comments and test cases a bit r/8810
This makes it easier to understand what the specific test is testing.

Change-Id: I34b2798841c6b9367849668451af2165dc78f997
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12626
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Reviewed-by: Jörg Thalheim <joerg@thalheim.io>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/glue/src/builtins/mod.rs26
1 files changed, 12 insertions, 14 deletions
diff --git a/tvix/glue/src/builtins/mod.rs b/tvix/glue/src/builtins/mod.rs
index 21685484867a..6149423acff0 100644
--- a/tvix/glue/src/builtins/mod.rs
+++ b/tvix/glue/src/builtins/mod.rs
@@ -537,14 +537,13 @@ mod tests {
         assert!(eval_result.errors.is_empty(), "errors should be empty");
     }
 
-    // Space is an illegal character.
+    /// Space is an illegal character, but if we specify a name without spaces, it's ok.
     #[rstest]
-    #[case(
+    #[case::rename_success(
         r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = true; })"#,
         true
     )]
-    // Space is still an illegal character.
-    #[case(
+    #[case::rename_with_spaces_fail(
         r#"(builtins.path { name = "invalid name"; path = @fixtures + "/te st"; recursive = true; })"#,
         false
     )]
@@ -583,14 +582,13 @@ mod tests {
         }
     }
 
-    // Space is an illegal character.
+    /// Space is an illegal character, but if we specify a name without spaces, it's ok.
     #[rstest]
-    #[case(
+    #[case::rename_success(
         r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = false; })"#,
         true
     )]
-    // Space is still an illegal character.
-    #[case(
+    #[case::rename_with_spaces_fail(
         r#"(builtins.path { name = "invalid name"; path = @fixtures + "/te st"; recursive = false; })"#,
         false
     )]
@@ -631,20 +629,20 @@ mod tests {
     }
 
     #[rstest]
-    #[case(
+    #[case::flat_success(
         r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = false; sha256 = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="; })"#,
         true
     )]
-    #[case(
-        r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = true; sha256 = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="; })"#,
+    #[case::flat_fail(
+        r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = false; sha256 = "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY="; })"#,
         false
     )]
-    #[case(
+    #[case::recursive_success(
         r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = true; sha256 = "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY="; })"#,
         true
     )]
-    #[case(
-        r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = false; sha256 = "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY="; })"#,
+    #[case::recursive_fail(
+        r#"(builtins.path { name = "valid-name"; path = @fixtures + "/te st"; recursive = true; sha256 = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="; })"#,
         false
     )]
     fn builtins_path_fod_locking(#[case] code: &str, #[case] exp_success: bool) {