source: trunk/abcl/test/lisp/abcl/url-pathname.lisp

Last change on this file was 15462, checked in by Mark Evenson, 3 years ago

Reflect current behavior in URI encoding tests

File size: 1.5 KB
Line 
1(in-package #:abcl.test.lisp)
2
3;; URL Pathname tests
4(deftest url-pathname.1
5    (let* ((p #p"http://example.org/a/b/foo.lisp")
6           (host (pathname-host p)))
7      (values 
8       (check-physical-pathname p '(:absolute "a" "b") "foo" "lisp")
9       (and (consp host)
10            (equal (getf host :scheme) 
11                   "http")
12            (equal (getf host :authority)
13                   "example.org"))))
14  t t)
15
16(deftest url-pathname.2
17    (let* ((p (pathname "http://example.org/a/b/foo.lisp?query=this#that-fragment"))
18           (host (pathname-host p)))
19      (values 
20       (check-physical-pathname p '(:absolute "a" "b") "foo" "lisp")
21       (consp host)
22       (getf host :scheme) 
23       (getf host :authority)
24       (getf host :query)
25       (getf host :fragment)))
26  t 
27  t
28  "http"
29  "example.org"
30  "query=this" 
31  "that-fragment")
32
33(deftest url-pathname.3
34    (let* ((p (pathname
35               "http://example.org/a/b/foo.lisp?query=this#that-fragment")))
36      (values 
37       (ext:url-pathname-scheme p)
38       (ext:url-pathname-authority p)
39       (ext:url-pathname-query p)
40       (ext:url-pathname-fragment p)))
41  "http"
42  "example.org"
43  "query=this" 
44  "that-fragment")
45
46(deftest url-pathname.file.1
47    (signals-error
48     (let ((s "file:///path with /spaces"))
49       (equal s
50              (namestring (pathname s))))
51     'error)
52  t)
53
54(deftest url-pathname.file.2
55    (let ((p "file:///path%20with/uri-escaped/%3fcharacters/"))
56      (pathname-directory p))
57  (:ABSOLUTE "path with" "uri-escaped" "?characters"))
58
Note: See TracBrowser for help on using the repository browser.