From 78837dd4dff0b6c66c231b08ebe466f2c1df9425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 31 Jan 2022 20:02:49 +0100 Subject: Write some extra tests. --- tests/util.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests/util.scm') diff --git a/tests/util.scm b/tests/util.scm index 6d4ca262..aa47a44f 100644 --- a/tests/util.scm +++ b/tests/util.scm @@ -3,7 +3,11 @@ ;;; Code: (((calp util) filter-sorted set/r! - find-min find-max span-upto)) + find-min find-max span-upto + iterate ->string ->quoted-string path-append + begin1) + ((ice-9 ports) with-output-to-string) + ) (test-equal "Filter sorted" '(3 4 5) @@ -46,3 +50,31 @@ (lambda (head tail) (test-equal '() head) (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail))) + + +(test-equal "begin1 side effects" "World" + (with-output-to-string + (lambda () + (test-equal "begin1 return value" "Hello" + (begin1 + "Hello" + (display "World")))))) + + +(test-equal 0 (iterate 1- zero? 10)) + + + +(test-equal "5" (->string 5)) +(test-equal "5" (->string "5")) + +(test-equal "5" (->quoted-string 5)) +(test-equal "\"5\"" (->quoted-string "5")) + + +(test-equal "/home/hugo/" + (path-append "/home" "hugo/")) + +(test-equal "/home/hugo/" (path-append "/" "/home/" "/hugo/")) + +(test-equal "/" (path-append "")) -- cgit v1.2.3