Compare commits
No commits in common. "28f40c5f6e49687512cc4a2d32ddb4b0dfe4db2f" and "0a26e42b6f271bad2a95330d4de24334b5ce69c6" have entirely different histories.
28f40c5f6e
...
0a26e42b6f
|
@ -38,79 +38,58 @@
|
||||||
|
|
||||||
(define-test mirror-img (:tags '(mirror-img))
|
(define-test mirror-img (:tags '(mirror-img))
|
||||||
(assert-eq
|
(assert-eq
|
||||||
'T
|
|
||||||
(stringp
|
(stringp
|
||||||
(setq *mirror-img-result*
|
(setq *mirror-img-result*
|
||||||
(mirror-img:mirror-img (relative-pathname "t/testing-website/index.html")
|
(mirror-img:mirror-img (relative-pathname "t/testing-website/index.html")
|
||||||
"tmp")))))
|
"tmp")))
|
||||||
|
'T))
|
||||||
|
|
||||||
(define-test mirror-img.files-mirrored (:tags '(mirror-img))
|
(define-test mirror-img.files-mirrored (:tags '(mirror-img))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
'("café" "fireplace" "merry christmas!!! ^_^" "more_calming" "style" "welcoming you")
|
|
||||||
(sort (mapcar #'pathname-name
|
(sort (mapcar #'pathname-name
|
||||||
(uiop:directory-files (relative-pathname "t/tmp/localhost/")))
|
(uiop:directory-files (relative-pathname "t/tmp/localhost/")))
|
||||||
#'string-lessp)))
|
#'string-lessp)
|
||||||
|
'("café" "fireplace" "merry christmas!!! ^_^" "more_calming" "style" "welcoming you")))
|
||||||
|
|
||||||
(define-test mirror-img.correct-urls (:tags '(mirror-img))
|
(define-test mirror-img.correct-urls (:tags '(mirror-img))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
|
(sort (mirror-img::linked-urls
|
||||||
|
(lquery:$ (lquery:initialize *mirror-img-result*)))
|
||||||
|
#'string-lessp)
|
||||||
'("tmp/localhost/café.jpg"
|
'("tmp/localhost/café.jpg"
|
||||||
"tmp/localhost/classy_fireplace.jpg"
|
"tmp/localhost/classy_fireplace.jpg"
|
||||||
"tmp/localhost/fireplace.jpg"
|
"tmp/localhost/fireplace.jpg"
|
||||||
"tmp/localhost/merry christmas!!! ^_^.jpg"
|
"tmp/localhost/merry christmas!!! ^_^.jpg"
|
||||||
"tmp/localhost/more_calming.jpg"
|
"tmp/localhost/more_calming.jpg"
|
||||||
"tmp/localhost/style.css"
|
"tmp/localhost/style.css"
|
||||||
"tmp/localhost/welcoming you.jpg")
|
"tmp/localhost/welcoming you.jpg")))
|
||||||
(sort (mirror-img::linked-urls
|
|
||||||
(lquery:$ (lquery:initialize *mirror-img-result*)))
|
|
||||||
#'string-lessp)))
|
|
||||||
|
|
||||||
(define-test mirrored-pathname (:tags '(base))
|
(define-test mirrored-pathname (:tags '(base))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
#p"base/invalid.tld/bird apple.txt"
|
|
||||||
(mirror-img::mirrored-pathname "https://invalid.tld/dir/bird apple.txt"
|
(mirror-img::mirrored-pathname "https://invalid.tld/dir/bird apple.txt"
|
||||||
:base-dir #p"base/")))
|
:base-dir #p"base/")
|
||||||
|
#p"base/invalid.tld/bird apple.txt"))
|
||||||
|
|
||||||
(define-test linked-urls (:tags '(dom))
|
(define-test linked-urls (:tags '(dom))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
|
(sort (mirror-img::linked-urls
|
||||||
|
(lquery:$ (lquery:initialize
|
||||||
|
(relative-pathname "t/testing-website/index.html"))))
|
||||||
|
#'string-lessp)
|
||||||
'("http://localhost:4242/res/img/b/fireplace.jpg"
|
'("http://localhost:4242/res/img/b/fireplace.jpg"
|
||||||
"http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/more_calming.jpg"
|
"http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/more_calming.jpg"
|
||||||
"http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/ĉu ĉi tio sufiĉe hazardas%3F!/classy_fireplace.jpg"
|
"http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/ĉu ĉi tio sufiĉe hazardas%3F!/classy_fireplace.jpg"
|
||||||
"http://localhost:4242/res/img/level-2/café.jpg"
|
"http://localhost:4242/res/img/level-2/café.jpg"
|
||||||
"http://localhost:4242/res/img/merry christmas!!! ^_^.jpg"
|
"http://localhost:4242/res/img/merry christmas!!! ^_^.jpg"
|
||||||
"http://localhost:4242/res/style.css"
|
"http://localhost:4242/res/style.css"
|
||||||
"http://localhost:4242/res/welcoming you.jpg")
|
"http://localhost:4242/res/welcoming you.jpg")))
|
||||||
(sort (mirror-img::linked-urls
|
|
||||||
(lquery:$ (lquery:initialize
|
|
||||||
(relative-pathname "t/testing-website/index.html"))))
|
|
||||||
#'string-lessp)))
|
|
||||||
|
|
||||||
(define-test url-encode-uri.space (:tags '(util))
|
(define-test url-encode-uri.space (:tags '(util))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
"https://invalid.tld/dad%20alive.jpg"
|
(mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg")
|
||||||
(mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg")))
|
"https://invalid.tld/dad%20alive.jpg"))
|
||||||
|
|
||||||
(define-test url-encode-path.space+exclamation (:tags '(util))
|
(define-test url-encode-path.space+exclamation (:tags '(util))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
"/images%21/dad%20alive.jpg"
|
(mirror-img::url-encode-path "/images!/dad alive.jpg")
|
||||||
(mirror-img::url-encode-path "/images!/dad alive.jpg")))
|
"/images%21/dad%20alive.jpg"))
|
||||||
|
|
||||||
(define-test uri-explicit-port.http80 (:tags '(util))
|
|
||||||
(assert-eq
|
|
||||||
nil
|
|
||||||
(mirror-img::uri-explicit-port (quri:uri "http://xwx.moe/bird.png"))))
|
|
||||||
|
|
||||||
(define-test uri-explicit-port.http443 (:tags '(util))
|
|
||||||
(assert-eq
|
|
||||||
443
|
|
||||||
(mirror-img::uri-explicit-port (quri:uri "http://xwx.moe:443/bird.png"))))
|
|
||||||
|
|
||||||
(define-test uri-explicit-port.https27 (:tags '(util))
|
|
||||||
(assert-eq
|
|
||||||
27
|
|
||||||
(mirror-img::uri-explicit-port (quri:uri "http://xwx.moe:27/bird.png"))))
|
|
||||||
|
|
||||||
(define-test uri-explicit-port.https443 (:tags '(util))
|
|
||||||
(assert-eq
|
|
||||||
nil
|
|
||||||
(mirror-img::uri-explicit-port (quri:uri "https://xwx.moe:443/bird.png"))))
|
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue