summaryrefslogtreecommitdiff
path: root/tests/utils.scm
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2016-04-06 17:35:13 +0800
committer宋文武 <iyzsong@gmail.com>2016-04-13 09:16:54 +0800
commit50a3d59473acf9fb5e771b57528b09d3e66123c4 (patch)
treead6d90815bcc847ec58d07e5e671623c37165476 /tests/utils.scm
parent645deac3264744ec09c027a8b9762fdf62aced70 (diff)
downloadpatches-50a3d59473acf9fb5e771b57528b09d3e66123c4.tar
patches-50a3d59473acf9fb5e771b57528b09d3e66123c4.tar.gz
utils: Add 'edit-expression'.
* guix/utils.scm (edit-expression): New procedure. * tests/utils.scm (edit-expression): New test.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 6b7725554f..d0ee02a1cf 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -333,6 +333,19 @@
"This is a journey\r\nInto the sound\r\nA journey ...\n")))
(get-string-all (canonical-newline-port port))))
+
+(test-equal "edit-expression"
+ "(display \"GNU Guix\")\n(newline)\n"
+ (begin
+ (call-with-output-file temp-file
+ (lambda (port)
+ (display "(display \"xiuG UNG\")\n(newline)\n" port)))
+ (edit-expression `((filename . ,temp-file)
+ (line . 0)
+ (column . 9))
+ string-reverse)
+ (call-with-input-file temp-file get-string-all)))
+
(test-end)
(false-if-exception (delete-file temp-file))