fix for new carp

This commit is contained in:
2021-01-19 10:55:37 +01:00
parent 2d62dee4d0
commit 4bf3e1c7c1
2 changed files with 10 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ variable we use on this OS.")
(def search-path-separator \;)
(def extension-pat #"\.[^\\/\.]*$")
(def sep-string "\\"))
(not-on-windows
(posix-only
(defn absolute? [p] (String.starts-with? p "/"))
(def separator \/)
(def separators [\/])
@@ -127,9 +127,9 @@ Examples on POSIX:
(doc drop-extension "drops the extension of a path `p`. Does nothing if there
is none.")
(defn drop-extension [p]
@(match (split-extension p)
(Maybe.Nothing) p
(Maybe.Just pair) (Pair.a &pair)))
(match (split-extension p)
(Maybe.Nothing) @p
(Maybe.Just pair) @(Pair.a &pair)))
(doc add-extension "adds an extension `ext` to a path `p`.")
(defn add-extension [p ext] (String.concat &[@p @"." @ext]))

View File

@@ -3,7 +3,7 @@
(use-all Path Test)
(not-on-windows
(posix-only
(deftest test
(assert-equal test
"path/joined"
@@ -41,11 +41,11 @@
"cwd works"
)
; TODO why does this test not work?
;(assert-equal test
; "file"
; &(drop-extension "file.txt")
; "drop-extension works if there is an extension"
;)
(assert-equal test
"file"
&(drop-extension "file.txt")
"drop-extension works if there is an extension"
)
(assert-equal test
"file"
&(drop-extension "file")