fix for new carp
This commit is contained in:
@@ -32,7 +32,7 @@ variable we use on this OS.")
|
|||||||
(def search-path-separator \;)
|
(def search-path-separator \;)
|
||||||
(def extension-pat #"\.[^\\/\.]*$")
|
(def extension-pat #"\.[^\\/\.]*$")
|
||||||
(def sep-string "\\"))
|
(def sep-string "\\"))
|
||||||
(not-on-windows
|
(posix-only
|
||||||
(defn absolute? [p] (String.starts-with? p "/"))
|
(defn absolute? [p] (String.starts-with? p "/"))
|
||||||
(def separator \/)
|
(def separator \/)
|
||||||
(def separators [\/])
|
(def separators [\/])
|
||||||
@@ -127,9 +127,9 @@ Examples on POSIX:
|
|||||||
(doc drop-extension "drops the extension of a path `p`. Does nothing if there
|
(doc drop-extension "drops the extension of a path `p`. Does nothing if there
|
||||||
is none.")
|
is none.")
|
||||||
(defn drop-extension [p]
|
(defn drop-extension [p]
|
||||||
@(match (split-extension p)
|
(match (split-extension p)
|
||||||
(Maybe.Nothing) p
|
(Maybe.Nothing) @p
|
||||||
(Maybe.Just pair) (Pair.a &pair)))
|
(Maybe.Just pair) @(Pair.a &pair)))
|
||||||
|
|
||||||
(doc add-extension "adds an extension `ext` to a path `p`.")
|
(doc add-extension "adds an extension `ext` to a path `p`.")
|
||||||
(defn add-extension [p ext] (String.concat &[@p @"." @ext]))
|
(defn add-extension [p ext] (String.concat &[@p @"." @ext]))
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
(use-all Path Test)
|
(use-all Path Test)
|
||||||
|
|
||||||
(not-on-windows
|
(posix-only
|
||||||
(deftest test
|
(deftest test
|
||||||
(assert-equal test
|
(assert-equal test
|
||||||
"path/joined"
|
"path/joined"
|
||||||
@@ -41,11 +41,11 @@
|
|||||||
"cwd works"
|
"cwd works"
|
||||||
)
|
)
|
||||||
; TODO why does this test not work?
|
; TODO why does this test not work?
|
||||||
;(assert-equal test
|
(assert-equal test
|
||||||
; "file"
|
"file"
|
||||||
; &(drop-extension "file.txt")
|
&(drop-extension "file.txt")
|
||||||
; "drop-extension works if there is an extension"
|
"drop-extension works if there is an extension"
|
||||||
;)
|
)
|
||||||
(assert-equal test
|
(assert-equal test
|
||||||
"file"
|
"file"
|
||||||
&(drop-extension "file")
|
&(drop-extension "file")
|
||||||
|
Reference in New Issue
Block a user