Skip to content

Commit

Permalink
.asd add puri-clppcre; tests as per rfc.
Browse files Browse the repository at this point in the history
  • Loading branch information
lisp committed Feb 2, 2010
1 parent ab58d9f commit d04b687
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
5 changes: 3 additions & 2 deletions puri-clppcre.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
;; the given package, that class is used for instantiation.
;; parse-uri-string (string)
;; This version uses cl-ppcre based on the regular expression from rfc3986.
;; (see *uri-pattern-string*) Returns values scheme, host, port, path,
;; query, fragment, and userinfo.
;; (see *uri-pattern-string*) It separates the compnent validation from the
;; parsing. Returns values scheme, host, port, path, query, fragment, and
;; userinfo.
;; uri-userinfo, uri-user, uri-password (uri)
;; The operators are defined to manipulate the instance's property list.
;; NB. The userinfo value does not appear in the printed representation.
Expand Down
4 changes: 3 additions & 1 deletion puri.asd
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
:maintainer "Kevin M. Rosenberg <kmr@debian.org>"
:licence "GNU Lesser General Public License"
:description "Portable Universal Resource Indentifier Library"
:serial t
:components
((:file "src")))
((:file "src")
(:file "puri-clppcre")))

(defmethod perform ((o test-op) (c (eql (find-system 'puri))))
(oos 'load-op 'puri-tests)
Expand Down
28 changes: 22 additions & 6 deletions tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@
:test 'string=)
res)
(push
#+(or) ;; rfc3986 syntax excludes this
`(test "foo%23bar#foobar#baz"
(format nil "~a" (parse-uri "foo%23bar#foobar#baz"))
:test 'string=)
`(test-error (format nil "~a" (parse-uri "foo%23bar#foobar#baz"))
:condition-type 'uri-parse-error)
res)
(push
`(test "foo%23bar#foobar#baz"
Expand All @@ -210,12 +213,16 @@
(format nil "~a" (parse-uri "foo%23bar#foobar%2fbaz"))
:test 'string=)
res)
(push `(test-error (parse-uri "foobar??")
:condition-type 'uri-parse-error)
res)
(push `(test-error (parse-uri "foobar?foo?")
:condition-type 'uri-parse-error)
res)
(push
#+(or) ;; rfc3986 permits this
`(test-error (parse-uri "foobar??") :condition-type 'uri-parse-error)
`(test "foobar??" (format nil "~a" (parse-uri "foobar??")) :test 'string=)
res)
(push
#+(or) ;; rfc3986 syntax permits this
`(test-error (parse-uri "foobar?foo?") :condition-type 'uri-parse-error)
`(test "foobar?foo?" (format nil "~a" (parse-uri "foobar?foo?")) :test 'string=)
res)
(push `(test "foobar?%3f"
(format nil "~a" (parse-uri "foobar?%3f"))
:test 'string=)
Expand Down Expand Up @@ -371,10 +378,12 @@
res)

(push
#+(or) ;; rfc3986 syntax precludes this
'(let ((puri::*strict-parse* nil))
(test-no-error
(puri:parse-uri
"http://foo.com/bar?a=zip|zop")))
`(test-error (parse-uri "http://foo.com/bar?a=zip|zop") :condition-type 'uri-parse-error)
res)
(push
'(test-error
Expand All @@ -389,10 +398,17 @@
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041")))
res)
(push
#+() ; rfc3986 permits the '?' in th query
'(test-error
(puri:parse-uri
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041")
:condition-type 'uri-parse-error)
'(test
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041"
(format nil "~a"
(puri:parse-uri
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041"))
:test 'string=)
res)

(push
Expand Down

0 comments on commit d04b687

Please sign in to comment.