aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-06 11:54:41 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-07 20:11:00 +0100
commit6f3f50197d1f02341d64a6943dfb52ea732244aa (patch)
tree0f5928d5dd34b39f607b88abc4b3273605feed70 /tests
parentAdd --verbose flag to testrunner. (diff)
downloadcalp-6f3f50197d1f02341d64a6943dfb52ea732244aa.tar.gz
calp-6f3f50197d1f02341d64a6943dfb52ea732244aa.tar.xz
Rewrote tests for path operations.
Diffstat (limited to 'tests')
-rw-r--r--tests/util.scm22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/util.scm b/tests/util.scm
index d308ea2a..37711a2e 100644
--- a/tests/util.scm
+++ b/tests/util.scm
@@ -6,7 +6,7 @@
find-min find-max span-upto
iterate ->string ->quoted-string
begin1)
- ((hnh util path) path-append)
+ ((hnh util path) path-append path-split)
((ice-9 ports) with-output-to-string)
((guile) set!)
)
@@ -62,18 +62,20 @@
(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 ""))
+(test-equal "no slashes" "home/user" (path-append "home" "user"))
+(test-equal "no slashes, absolute" "/home/user" (path-append "" "home" "user"))
+(test-equal "slashes in one component, absolute" "/home/user" (path-append "" "/home/" "user"))
+(test-equal "slashes in one component, absolute due to first" "/home/user" (path-append "/home/" "user"))
+(test-equal "Slashes in both" "home/user" (path-append "home/" "/user"))
+(test-equal "root" "/" (path-append ""))
+
+(test-equal '("usr" "lib" "test") (path-split "usr/lib/test"))
+(test-equal '("usr" "lib" "test") (path-split "usr/lib/test/"))
+(test-equal '("" "usr" "lib" "test") (path-split "/usr/lib/test"))
+(test-equal '("" "usr" "lib" "test") (path-split "//usr////lib/test"))