Swap order of test functions and expected results

No functional change.
This commit is contained in:
Jaidyn Ann 2024-05-28 23:17:58 -05:00
parent 0a26e42b6f
commit 73e88853df

View File

@ -38,58 +38,59 @@
(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/Im trying hard to randomly name these directories/more_calming.jpg" "http://localhost:4242/res/img/b/Im trying hard to randomly name these directories/more_calming.jpg"
"http://localhost:4242/res/img/b/Im trying hard to randomly name these directories/ĉu ĉi tio sufiĉe hazardas%3F!/classy_fireplace.jpg" "http://localhost:4242/res/img/b/Im 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")))