Skip to content

Commit

Permalink
Remove unnecessary rm-rf
Browse files Browse the repository at this point in the history
  • Loading branch information
Takahiro Hozumi committed Nov 6, 2011
1 parent e1a88cf commit 7335ce0
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions test/org/satta/glob_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@
"*/*/a*" ["usr/bin/awk" "usr/sbin/arp"]
"*/*/*/*" ["usr/share/man/man1" "usr/share/man/man2" "usr/share/man/man3"])))

(defn rm-rf [^File f & [silently]]
(if (.isDirectory f)
(map #(rm-rf % silently) (.listFiles f)))
(io/delete-file f silently))

(defn mk-temp-file
[^File f]
(doto f
Expand Down Expand Up @@ -219,7 +214,6 @@
(let [dir-name (str (System/getProperty "java.io.tmpdir")
"org.satta.glob-test/")
dir (io/file dir-name)]
(rm-rf dir :silently)
(mk-temp-dir dir)
(let [shallow-dir (mk-tmpfs dir shallow-fs1)]
(testing "Simple, shallow (single-level) matching"
Expand All @@ -244,8 +238,7 @@
(glob (str dir-name (first shallow-fs1)
"/" pattern) :a))
files)
"*" [".hidden" "cat.jpg" "dog.jpg" "lol.gif"]))
(rm-rf shallow-dir :silently))
"*" [".hidden" "cat.jpg" "dog.jpg" "lol.gif"])))
(let [deep-dir (mk-tmpfs dir deep-fs1)]
(testing "Deep (multi-level) matching"
(are [pattern files] (= (map (fn [^File f] (.getName f))
Expand All @@ -258,8 +251,7 @@
"*/*/a*" ["awk" "arp"]
"**/s*a*" ["share" "samba" "sendmail"]
"**AA" []
"*/*/*/*" ["man1" "man2" "man3"]))
(rm-rf deep-dir :silently))
"*/*/*/*" ["man1" "man2" "man3"])))
(let [deep-dir2 (mk-tmpfs dir deep-fs2)]
(testing "Deep (multi-level) matching2"
(are [pattern files] (= (map (fn [^File f] (.getName f))
Expand All @@ -270,6 +262,4 @@
"**/*clj" ["a.clj" "b.clj" "c.clj" "d.clj"]
"**/*/*clj" ["b.clj" "c.clj" "d.clj"]
"**/*/*/*clj" ["c.clj" "d.clj"]
"l**" ["lib" "lab" "lob"]))
(rm-rf deep-dir2 :silently))
(rm-rf dir :silently)))
"l**" ["lib" "lab" "lob"])))))

0 comments on commit 7335ce0

Please sign in to comment.