mirror of https://codeberg.org/glenneth/stash.git
43 lines
1.2 KiB
Scheme
43 lines
1.2 KiB
Scheme
(use-modules (srfi srfi-64)
|
|
(stash paths))
|
|
|
|
(test-begin "paths")
|
|
|
|
;; Test normalize-path
|
|
(test-group "normalize-path"
|
|
(test-equal "Simple path normalization"
|
|
"/home/user/file"
|
|
(normalize-path "/home/user/file"))
|
|
|
|
(test-equal "Remove double slashes"
|
|
"/home/user/file"
|
|
(normalize-path "/home//user///file"))
|
|
|
|
(test-equal "Handle dot notation"
|
|
"/home/user/file"
|
|
(normalize-path "/home/user/./file"))
|
|
|
|
(test-equal "Handle dot-dot notation"
|
|
"/home/file"
|
|
(normalize-path "/home/user/../file"))
|
|
|
|
(test-equal "Handle home directory expansion"
|
|
(string-append (getenv "HOME") "/file")
|
|
(normalize-path "~/file")))
|
|
|
|
;; Test relative path handling
|
|
(test-group "relative-path"
|
|
(test-equal "Simple relative path"
|
|
"file"
|
|
(relative-path "/home/user" "/home/user/file"))
|
|
|
|
(test-equal "Nested relative path"
|
|
"dir/file"
|
|
(relative-path "/home/user" "/home/user/dir/file"))
|
|
|
|
(test-equal "Parent directory"
|
|
"../file"
|
|
(relative-path "/home/user/dir" "/home/user/file")))
|
|
|
|
(test-end "paths")
|