summaryrefslogtreecommitdiff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-11-12 22:56:13 +0100
committerLudovic Courtès <ludo@gnu.org>2013-11-13 00:29:05 +0100
commit56b943de6e61f41d6ebd2dfa65ff886cdfd83759 (patch)
tree3669027822242116653430944897e0a27ca58f55 /tests/utils.scm
parentbe0f611208b4e6d730991267f69f9effe703e32f (diff)
utils: Add 'string-replace-substring'.
* guix/utils.scm (string-replace-substring): New procedure. Based on code by Mark H. Weaver. * tests/utils.scm ("string-replace-substring"): New test.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 4f6ecc514de..017d9170fa7 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -82,6 +82,14 @@
82 (string-tokenize* "foo!bar!" "!") 82 (string-tokenize* "foo!bar!" "!")
83 (string-tokenize* "foo+-+bar+-+baz" "+-+"))) 83 (string-tokenize* "foo+-+bar+-+baz" "+-+")))
84 84
85(test-equal "string-replace-substring"
86 '("foo BAR! baz"
87 "/gnu/store/chbouib"
88 "")
89 (list (string-replace-substring "foo bar baz" "bar" "BAR!")
90 (string-replace-substring "/nix/store/chbouib" "/nix/" "/gnu/")
91 (string-replace-substring "" "foo" "bar")))
92
85(test-equal "fold2, 1 list" 93(test-equal "fold2, 1 list"
86 (list (reverse (iota 5)) 94 (list (reverse (iota 5))
87 (map - (reverse (iota 5)))) 95 (map - (reverse (iota 5))))