diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-11-12 22:56:13 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-11-13 00:29:05 +0100 |
commit | 56b943de6e61f41d6ebd2dfa65ff886cdfd83759 (patch) | |
tree | 3669027822242116653430944897e0a27ca58f55 /tests/utils.scm | |
parent | be0f611208b4e6d730991267f69f9effe703e32f (diff) | |
download | gnu-guix-56b943de6e61f41d6ebd2dfa65ff886cdfd83759.tar gnu-guix-56b943de6e61f41d6ebd2dfa65ff886cdfd83759.tar.gz |
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.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm index 4f6ecc514d..017d9170fa 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -82,6 +82,14 @@ (string-tokenize* "foo!bar!" "!") (string-tokenize* "foo+-+bar+-+baz" "+-+"))) +(test-equal "string-replace-substring" + '("foo BAR! baz" + "/gnu/store/chbouib" + "") + (list (string-replace-substring "foo bar baz" "bar" "BAR!") + (string-replace-substring "/nix/store/chbouib" "/nix/" "/gnu/") + (string-replace-substring "" "foo" "bar"))) + (test-equal "fold2, 1 list" (list (reverse (iota 5)) (map - (reverse (iota 5)))) |