Compare commits
2 Enmetoj
0a26e42b6f
...
28f40c5f6e
Author | SHA1 | Date | |
---|---|---|---|
Jaidyn Ann | 28f40c5f6e | ||
Jaidyn Ann | 73e88853df |
|
@ -38,58 +38,79 @@
|
||||||
|
|
||||||
(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
|
||||||
(mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg")
|
"https://invalid.tld/dad%20alive.jpg"
|
||||||
"https://invalid.tld/dad%20alive.jpg"))
|
(mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg")))
|
||||||
|
|
||||||
(define-test url-encode-path.space+exclamation (:tags '(util))
|
(define-test url-encode-path.space+exclamation (:tags '(util))
|
||||||
(assert-equal
|
(assert-equal
|
||||||
(mirror-img::url-encode-path "/images!/dad alive.jpg")
|
"/images%21/dad%20alive.jpg"
|
||||||
"/images%21/dad%20alive.jpg"))
|
(mirror-img::url-encode-path "/images!/dad alive.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