diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-10-16 23:01:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-10-16 23:01:01 +0200 |
commit | 91133c2d71960644eeba749027a4141c098ea64c (patch) | |
tree | a7ad834387f365dc7717ef3732a6082cd7eee123 /tests | |
parent | dcd72906545816938d16af3afca0ffa9e4ce3dcf (diff) | |
download | gnu-guix-91133c2d71960644eeba749027a4141c098ea64c.tar gnu-guix-91133c2d71960644eeba749027a4141c098ea64c.tar.gz |
utils: Add `fold-port-matches' and `remove-store-references'.
* guix/build/utils.scm (fold-port-matches, remove-store-references): New
procedures.
* tests/build-utils.scm ("fold-port-matches", "fold-port-matches,
trickier", "fold-port-matches, with unmatched chars"): New tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build-utils.scm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/build-utils.scm b/tests/build-utils.scm index 4d86037708..8140708397 100644 --- a/tests/build-utils.scm +++ b/tests/build-utils.scm @@ -47,6 +47,39 @@ (not (false-if-exception (alist-replace 'z 77 '((a . 1) (b . 2) (c . 3)))))) +(test-equal "fold-port-matches" + (make-list 3 "Guix") + (call-with-input-string "Guix is cool, Guix rocks, and it uses Guile, Guix!" + (lambda (port) + (fold-port-matches cons '() "Guix" port)))) + +(test-equal "fold-port-matches, trickier" + (reverse '("Guix" "guix" "Guix" "guiX" "Guix")) + (call-with-input-string "Guix, guix, GuiGuixguiX, Guix" + (lambda (port) + (fold-port-matches cons '() + (list (char-set #\G #\g) + (char-set #\u) + (char-set #\i) + (char-set #\x #\X)) + port)))) + +(test-equal "fold-port-matches, with unmatched chars" + '("Guix" #\, #\space + "guix" #\, #\space + #\G #\u #\i "Guix" "guiX" #\, #\space + "Guix") + (call-with-input-string "Guix, guix, GuiGuixguiX, Guix" + (lambda (port) + (reverse + (fold-port-matches cons '() + (list (char-set #\G #\g) + (char-set #\u) + (char-set #\i) + (char-set #\x #\X)) + port + cons))))) + (test-end) @@ -55,4 +88,5 @@ ;;; Local Variables: ;;; eval: (put 'test-assert 'scheme-indent-function 1) ;;; eval: (put 'test-equal 'scheme-indent-function 1) +;;; eval: (put 'call-with-input-string 'scheme-indent-function 1) ;;; End: |