aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-31 20:02:49 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-31 20:02:49 +0100
commit78837dd4dff0b6c66c231b08ebe466f2c1df9425 (patch)
treebce629dc2a281dc842b86b4a85800f4b95b5ffa3 /tests
parentAdd span-upto. (diff)
downloadcalp-78837dd4dff0b6c66c231b08ebe466f2c1df9425.tar.gz
calp-78837dd4dff0b6c66c231b08ebe466f2c1df9425.tar.xz
Write some extra tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/util.scm34
1 files changed, 33 insertions, 1 deletions
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 ""))