From ccab9c06a2f01353b8a91469d46a498a75961431 Mon Sep 17 00:00:00 2001 From: James Landrein Date: Tue, 25 Oct 2022 13:56:14 +0200 Subject: feat(tvix/eval): add builtins.replaceStrings Change-Id: I93dcdaeb101364ee2273bcaeb19acb57cf6b9e7d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7034 Autosubmit: j4m3s Reviewed-by: Adam Joseph Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.exp | 1 + tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.nix | 11 +++++++++++ .../nix_tests/notyetpassing/eval-okay-replacestrings.exp | 1 - .../nix_tests/notyetpassing/eval-okay-replacestrings.nix | 11 ----------- .../tests/tvix_tests/eval-okay-builtins-replaceStrings.exp | 1 + .../tests/tvix_tests/eval-okay-builtins-replaceStrings.nix | 5 +++++ 6 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.exp create mode 100644 tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.nix delete mode 100644 tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.exp delete mode 100644 tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.nix (limited to 'tvix/eval/src/tests') diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.exp b/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.exp new file mode 100644 index 000000000000..72e8274d8c58 --- /dev/null +++ b/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.exp @@ -0,0 +1 @@ +[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ] diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.nix b/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.nix new file mode 100644 index 000000000000..bd8031fc004e --- /dev/null +++ b/tvix/eval/src/tests/nix_tests/eval-okay-replacestrings.nix @@ -0,0 +1,11 @@ +with builtins; + +[ (replaceStrings ["o"] ["a"] "foobar") + (replaceStrings ["o"] [""] "foobar") + (replaceStrings ["oo"] ["u"] "foobar") + (replaceStrings ["oo" "a"] ["a" "oo"] "foobar") + (replaceStrings ["oo" "oo"] ["u" "i"] "foobar") + (replaceStrings [""] ["X"] "abc") + (replaceStrings [""] ["X"] "") + (replaceStrings ["-"] ["_"] "a-b") +] diff --git a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.exp b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.exp deleted file mode 100644 index 72e8274d8c58..000000000000 --- a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.exp +++ /dev/null @@ -1 +0,0 @@ -[ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ] diff --git a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.nix b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.nix deleted file mode 100644 index bd8031fc004e..000000000000 --- a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-replacestrings.nix +++ /dev/null @@ -1,11 +0,0 @@ -with builtins; - -[ (replaceStrings ["o"] ["a"] "foobar") - (replaceStrings ["o"] [""] "foobar") - (replaceStrings ["oo"] ["u"] "foobar") - (replaceStrings ["oo" "a"] ["a" "oo"] "foobar") - (replaceStrings ["oo" "oo"] ["u" "i"] "foobar") - (replaceStrings [""] ["X"] "abc") - (replaceStrings [""] ["X"] "") - (replaceStrings ["-"] ["_"] "a-b") -] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.exp new file mode 100644 index 000000000000..c2cb89bac663 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.exp @@ -0,0 +1 @@ +[ "fabir" "a" "1a1" ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.nix new file mode 100644 index 000000000000..b8101c448bb0 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-replaceStrings.nix @@ -0,0 +1,5 @@ +[ + (builtins.replaceStrings ["oo" "a"] ["a" "i"] "foobar") + (builtins.replaceStrings ["o"] ["a"] "a") + (builtins.replaceStrings ["" ""] ["1" "2"] "a") +] -- cgit 1.4.1