From beb7f57c73473598c51b14221c5e4996c81d2dde Mon Sep 17 00:00:00 2001 From: binarycat Date: Sun, 2 Jun 2024 19:58:54 +0200 Subject: fix(tvix/eval): handle builtins.split matching the empty string This prevents the following statements from looping endlessly: ``` builtins.split "(.*)" "" builtins.split "([abc]*)" "abc" builtins.split "(.*)" "abc" builtins.split ".*" "" ``` Cover these (and some more examples) in the test suite. Co-Authored-By: Florian Klink Change-Id: Ibd339f971e0f4e3e5c229816e2be5a8e3836fec9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11743 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix new file mode 100644 index 000000000000..95305040dce2 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-split.nix @@ -0,0 +1,10 @@ +[ + (builtins.split "(a)b" "abc") + (builtins.split "([ac])" "abc") + (builtins.split "(a)|(c)" "abc") + (builtins.split "([[:upper:]]+)" " FOO ") + + (builtins.split "(.*)" "abc") + (builtins.split "([abc]*)" "abc") + (builtins.split ".*" "") +] -- cgit 1.4.1