Carp/test/filepath.carp
2019-03-22 20:33:06 +01:00

38 lines
1.1 KiB
Plaintext

(load "core/Filepath.carp") ;; specified path to avoid loading itself on case insensitive file systems
(load "Test.carp")
(use-all Test Filepath)
(deftest test
(assert-equal test
"test.h"
&(file-from-path "/an/absolute/path/for/test.h")
"file-from-path works with non-empty paths"
)
(assert-equal test
"."
&(file-from-path ".")
"file-from-path works with relative paths"
)
(assert-equal test
""
&(file-from-path "")
"file-from-path works with empty paths"
)
(assert-equal test
"/an/absolute/path/for/"
&(dir-from-path "/an/absolute/path/for/test.h")
"dir-from-path works with non-empty paths"
)
(assert-equal test
""
&(dir-from-path ".")
"dir-from-path works with relative paths"
)
(assert-equal test
""
&(dir-from-path "")
"dir-from-path works with empty paths"
)
)