about summary refs log tree commit diff
path: root/tests/lang
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-24T13·32+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-24T13·32+0200
commitd6d5885c1567454754a0d260521bafa0bd5e7fdb (patch)
treee97b212c7d752c4b37ff29536c3c3315c11d3088 /tests/lang
parent2e8fd4c5cdeb59ae2bd403aa5069993303e8388e (diff)
Add replaceStrings primop
This is a generalisation of replaceChars in Nixpkgs.
Diffstat (limited to 'tests/lang')
-rw-r--r--tests/lang/eval-okay-replacestrings.exp1
-rw-r--r--tests/lang/eval-okay-replacestrings.nix8
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-replacestrings.exp b/tests/lang/eval-okay-replacestrings.exp
new file mode 100644
index 000000000000..a2add1b7b140
--- /dev/null
+++ b/tests/lang/eval-okay-replacestrings.exp
@@ -0,0 +1 @@
+[ "faabar" "fbar" "fubar" "faboor" "fubar" ]
diff --git a/tests/lang/eval-okay-replacestrings.nix b/tests/lang/eval-okay-replacestrings.nix
new file mode 100644
index 000000000000..6284a0e660ae
--- /dev/null
+++ b/tests/lang/eval-okay-replacestrings.nix
@@ -0,0 +1,8 @@
+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")
+]