From baebe29bab5d02607b7811dbc2542f708aee2665 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 15 Oct 2024 16:17:45 +0300 Subject: test(tvix/glue): improve comments and test cases a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ilan Joselevich Tested-by: BuildkiteCI Reviewed-by: Jörg Thalheim --- tvix/glue/src/builtins/mod.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'tvix/glue/src/builtins') 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) { -- cgit 1.4.1