source: branches/1.1.x/test/lisp/abcl/url-pathname.lisp

Last change on this file was 12617, checked in by Mark Evenson, 15 years ago

Move pathname functions to EXT; implement DEFSETF for URL pathnames.

Implemented DEFSETF functions for HOST, AUTHORITY, QUERY, and FRAGMENT
sections of URL pathname.

Moved PATHNAME-JAR-P and PATHNAME-URL-P to EXT.

EXT::%INVALIDATE-NAMESTRING resets the namestring after changing the
internal structure. Having to monkey around with the internal
structure of Pathname is just wrong: we should implement the get/set
accessor pattern in Java even though it would make the code more
verbose.

File size: 1.2 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")
Note: See TracBrowser for help on using the repository browser.