r5323: *** empty log message ***
This commit is contained in:
21
debian/changelog
vendored
Normal file
21
debian/changelog
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
cl-uri (1.2-1) unstable; urgency=low
|
||||
|
||||
* More porting fixes
|
||||
|
||||
-- Kevin M. Rosenberg <kmr@debian.org> Fri, 18 Jul 2003 13:59:51 -0600
|
||||
|
||||
cl-uri (1.1-1) unstable; urgency=low
|
||||
|
||||
* Fix some porting issues
|
||||
|
||||
-- Kevin M. Rosenberg <kmr@debian.org> Fri, 18 Jul 2003 08:59:04 -0600
|
||||
|
||||
cl-uri (1.0) unstable; urgency=low
|
||||
|
||||
* Initial upload
|
||||
* Changes compared to upstream:
|
||||
- Added .asd file for use with ASDF
|
||||
- Include if* source in the uri-src.lisp file
|
||||
- Ported from AllegroCL specific functions
|
||||
|
||||
-- Kevin M. Rosenberg <kmr@debian.org> Thu, 17 Jul 2003 21:39:34 -0600
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
4
|
||||
16
debian/control
vendored
Normal file
16
debian/control
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
Source: cl-puri
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Kevin M. Rosenberg <kmr@debian.org>
|
||||
Build-Depends-Indep: debhelper (>= 4.0.0)
|
||||
Standards-Version: 3.6.0
|
||||
|
||||
Package: cl-puri
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, common-lisp-controller (>= 3.47)
|
||||
Recommends: cl-tester
|
||||
Description: Common Lisp Portable URI Library
|
||||
This is portable Universal Resource Identifier (RFC 2396)
|
||||
library for Common Lisp programs. It's is based on Franz,
|
||||
Inc's opensource package with porting work perform to run on
|
||||
other platforms. A regression test package is included.
|
||||
90
debian/copyright
vendored
Normal file
90
debian/copyright
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
This package was debianized by Kevin M. Rosenberg <kmr@debian.org> in
|
||||
July 2003.
|
||||
|
||||
It was downloaded from http://opensource.franz.com/uri/
|
||||
Upstream Authors: Franz Inc. with modifications by Kevin Rosenberg
|
||||
|
||||
Copyright:
|
||||
|
||||
copyright (c) 1986-2000 Franz Inc, Berkeley, CA
|
||||
copyright (c) 2003 Kevin Rosenberg
|
||||
|
||||
This code is free software; you can redistribute it and/or modify it
|
||||
under the terms of the version 2.1 of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation, as clarified by
|
||||
the Franz preamble to the LGPL found in
|
||||
http://opensource.franz.com/preamble.html. The preambled is copied
|
||||
below.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but without any warranty; without even the implied warranty of
|
||||
merchantability or fitness for a particular purpose. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
The GNU Lessor General Public License can be found in your Debian file
|
||||
system in /usr/share/common-licenses/LGPL.
|
||||
|
||||
Preamble to the Gnu Lesser General Public License
|
||||
-------------------------------------------------
|
||||
Copyright (c) 2000 Franz Incorporated, Berkeley, CA 94704
|
||||
|
||||
The concept of the GNU Lesser General Public License version 2.1
|
||||
("LGPL") has been adopted to govern the use and distribution of
|
||||
above-mentioned application. However, the LGPL uses terminology that
|
||||
is more appropriate for a program written in C than one written in
|
||||
Lisp. Nevertheless, the LGPL can still be applied to a Lisp program if
|
||||
certain clarifications are made. This document details those
|
||||
clarifications. Accordingly, the license for the open-source Lisp
|
||||
applications consists of this document plus the LGPL. Wherever there
|
||||
is a conflict between this document and the LGPL, this document takes
|
||||
precedence over the LGPL.
|
||||
|
||||
A "Library" in Lisp is a collection of Lisp functions, data and
|
||||
foreign modules. The form of the Library can be Lisp source code (for
|
||||
processing by an interpreter) or object code (usually the result of
|
||||
compilation of source code or built with some other
|
||||
mechanisms). Foreign modules are object code in a form that can be
|
||||
linked into a Lisp executable. When we speak of functions we do so in
|
||||
the most general way to include, in addition, methods and unnamed
|
||||
functions. Lisp "data" is also a general term that includes the data
|
||||
structures resulting from defining Lisp classes. A Lisp application
|
||||
may include the same set of Lisp objects as does a Library, but this
|
||||
does not mean that the application is necessarily a "work based on the
|
||||
Library" it contains.
|
||||
|
||||
The Library consists of everything in the distribution file set before
|
||||
any modifications are made to the files. If any of the functions or
|
||||
classes in the Library are redefined in other files, then those
|
||||
redefinitions ARE considered a work based on the Library. If
|
||||
additional methods are added to generic functions in the Library,
|
||||
those additional methods are NOT considered a work based on the
|
||||
Library. If Library classes are subclassed, these subclasses are NOT
|
||||
considered a work based on the Library. If the Library is modified to
|
||||
explicitly call other functions that are neither part of Lisp itself
|
||||
nor an available add-on module to Lisp, then the functions called by
|
||||
the modified Library ARE considered a work based on the Library. The
|
||||
goal is to ensure that the Library will compile and run without
|
||||
getting undefined function errors.
|
||||
|
||||
It is permitted to add proprietary source code to the Library, but it
|
||||
must be done in a way such that the Library will still run without
|
||||
that proprietary code present. Section 5 of the LGPL distinguishes
|
||||
between the case of a library being dynamically linked at runtime and
|
||||
one being statically linked at build time. Section 5 of the LGPL
|
||||
states that the former results in an executable that is a "work that
|
||||
uses the Library." Section 5 of the LGPL states that the latter
|
||||
results in one that is a "derivative of the Library", which is
|
||||
therefore covered by the LGPL. Since Lisp only offers one choice,
|
||||
which is to link the Library into an executable at build time, we
|
||||
declare that, for the purpose applying the LGPL to the Library, an
|
||||
executable that results from linking a "work that uses the Library"
|
||||
with the Library is considered a "work that uses the Library" and is
|
||||
therefore NOT covered by the LGPL.
|
||||
|
||||
Because of this declaration, section 6 of LGPL is not applicable to
|
||||
the Library. However, in connection with each distribution of this
|
||||
executable, you must also deliver, in accordance with the terms and
|
||||
conditions of the LGPL, the source code of Library (or your derivative
|
||||
thereof) that is incorporated into this executable.
|
||||
|
||||
|
||||
43
debian/postinst
vendored
Normal file
43
debian/postinst
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
LISP_PKG=puri
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
#
|
||||
# quoting from the policy:
|
||||
# Any necessary prompting should almost always be confined to the
|
||||
# post-installation script, and should be protected with a conditional
|
||||
# so that unnecessary prompting doesn't happen if a package's
|
||||
# installation fails and the `postinst' is called with `abort-upgrade',
|
||||
# `abort-remove' or `abort-deconfigure'.
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
/usr/sbin/register-common-lisp-source ${LISP_PKG}
|
||||
;;
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
37
debian/prerm
vendored
Normal file
37
debian/prerm
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
LISP_PKG=puri
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <prerm> `remove'
|
||||
# * <old-prerm> `upgrade' <new-version>
|
||||
# * <new-prerm> `failed-upgrade' <old-version>
|
||||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
||||
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
||||
# <package-being-installed> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
/usr/sbin/unregister-common-lisp-source ${LISP_PKG}
|
||||
;;
|
||||
failed-upgrade)
|
||||
;;
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
67
debian/rules
vendored
Executable file
67
debian/rules
vendored
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
pkg := puri
|
||||
debpkg := cl-puri
|
||||
|
||||
|
||||
clc-source := usr/share/common-lisp/source
|
||||
clc-systems := usr/share/common-lisp/systems
|
||||
clc-puri := $(clc-source)/$(pkg)
|
||||
|
||||
doc-dir := usr/share/doc/$(debpkg)
|
||||
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
# Add here commands to compile the package.
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
rm -f debian/cl-puri.postinst.* debian/cl-puri.prerm.*
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
# Add here commands to install the package into debian/puri.
|
||||
dh_installdirs $(clc-systems) $(clc-puri)
|
||||
dh_install *.asd $(shell echo *.lisp) $(clc-puri)
|
||||
dh_link $(clc-puri)/puri.asd $(clc-systems)/puri.asd
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdocs
|
||||
dh_installchangelogs
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
|
||||
29
puri.asd
Normal file
29
puri.asd
Normal file
@ -0,0 +1,29 @@
|
||||
;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
|
||||
;;;; Programmer: Kevin Rosenberg
|
||||
|
||||
|
||||
(in-package #:cl-user)
|
||||
(defpackage #:puri-system (:use #:cl #:asdf))
|
||||
(in-package #:puri-system)
|
||||
|
||||
|
||||
(defsystem puri
|
||||
:name "cl-puri"
|
||||
:maintainer "Kevin M. Rosenberg <kmr@debian.org>"
|
||||
:licence "GNU Lesser General Public License"
|
||||
:description "Portable Universal Resource Indentifier Library"
|
||||
:components
|
||||
((:file "src")))
|
||||
|
||||
(defmethod perform ((o test-op) (c (eql (find-system 'puri))))
|
||||
(oos 'load-op 'puri-tests)
|
||||
(oos 'test-op 'puri-tests))
|
||||
|
||||
(defsystem puri-tests
|
||||
:depends-on (:rt :tester)
|
||||
:components
|
||||
((:file "tests")))
|
||||
|
||||
(defmethod perform ((o test-op) (c (eql (find-system 'puri-tests))))
|
||||
(or (funcall (intern (symbol-name '#:do-tests) (find-package :rt)))
|
||||
(error "test-op failed")))
|
||||
413
tests.lisp
Normal file
413
tests.lisp
Normal file
@ -0,0 +1,413 @@
|
||||
;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
|
||||
;; copyright (c) 1999-2001 Franz Inc, Berkeley, CA - All rights reserved.
|
||||
;; copyright (c) 2003 Kevin Rosenberg (significant fixes for using
|
||||
;; tester package)
|
||||
;;
|
||||
;; The software, data and information contained herein are proprietary
|
||||
;; to, and comprise valuable trade secrets of, Franz, Inc. They are
|
||||
;; given in confidence by Franz, Inc. pursuant to a written license
|
||||
;; agreement, and may be stored and used only in accordance with the terms
|
||||
;; of such license.
|
||||
;;
|
||||
;; Restricted Rights Legend
|
||||
;; ------------------------
|
||||
;; Use, duplication, and disclosure of the software, data and information
|
||||
;; contained herein by any agency, department or entity of the U.S.
|
||||
;; Government are subject to restrictions of Restricted Rights for
|
||||
;; Commercial Software developed at private expense as specified in
|
||||
;; DOD FAR Supplement 52.227-7013 (c) (1) (ii), as applicable.
|
||||
;;
|
||||
;; Original version from ACL 6.1:
|
||||
;; t-uri.cl,v 1.3.6.3.2.1 2001/08/09 17:42:43 layer
|
||||
;;
|
||||
;; $Id: tests.lisp,v 1.1 2003/07/18 20:34:23 kevin Exp $
|
||||
|
||||
|
||||
(defpackage #:puri-tests (:use #:puri #:cl #:util.test))
|
||||
(in-package #:puri-tests)
|
||||
|
||||
(unintern-uri t)
|
||||
|
||||
(defparameter *tests*
|
||||
(let ((res '())
|
||||
(base-uri "http://a/b/c/d;p?q"))
|
||||
|
||||
(dolist (x `(;; (relative-uri result base-uri compare-function)
|
||||
;;;; RFC Appendix C.1 (normal examples)
|
||||
("g:h" "g:h" ,base-uri)
|
||||
("g" "http://a/b/c/g" ,base-uri)
|
||||
("./g" "http://a/b/c/g" ,base-uri)
|
||||
("g/" "http://a/b/c/g/" ,base-uri)
|
||||
("/g" "http://a/g" ,base-uri)
|
||||
("//g" "http://g" ,base-uri)
|
||||
("?y" "http://a/b/c/?y" ,base-uri)
|
||||
("g?y" "http://a/b/c/g?y" ,base-uri)
|
||||
("#s" "http://a/b/c/d;p?q#s" ,base-uri)
|
||||
("g#s" "http://a/b/c/g#s" ,base-uri)
|
||||
("g?y#s" "http://a/b/c/g?y#s" ,base-uri)
|
||||
(";x" "http://a/b/c/;x" ,base-uri)
|
||||
("g;x" "http://a/b/c/g;x" ,base-uri)
|
||||
("g;x?y#s" "http://a/b/c/g;x?y#s" ,base-uri)
|
||||
("." "http://a/b/c/" ,base-uri)
|
||||
("./" "http://a/b/c/" ,base-uri)
|
||||
(".." "http://a/b/" ,base-uri)
|
||||
("../" "http://a/b/" ,base-uri)
|
||||
("../g" "http://a/b/g" ,base-uri)
|
||||
("../.." "http://a/" ,base-uri)
|
||||
("../../" "http://a/" ,base-uri)
|
||||
("../../g" "http://a/g" ,base-uri)
|
||||
;;;; RFC Appendix C.2 (abnormal examples)
|
||||
("" "http://a/b/c/d;p?q" ,base-uri)
|
||||
("../../../g" "http://a/../g" ,base-uri)
|
||||
("../../../../g" "http://a/../../g" ,base-uri)
|
||||
("/./g" "http://a/./g" ,base-uri)
|
||||
("/../g" "http://a/../g" ,base-uri)
|
||||
("g." "http://a/b/c/g." ,base-uri)
|
||||
(".g" "http://a/b/c/.g" ,base-uri)
|
||||
("g.." "http://a/b/c/g.." ,base-uri)
|
||||
("..g" "http://a/b/c/..g" ,base-uri)
|
||||
("./../g" "http://a/b/g" ,base-uri)
|
||||
("./g/." "http://a/b/c/g/" ,base-uri)
|
||||
("g/./h" "http://a/b/c/g/h" ,base-uri)
|
||||
("g/../h" "http://a/b/c/h" ,base-uri)
|
||||
("g;x=1/./y" "http://a/b/c/g;x=1/y" ,base-uri)
|
||||
("g;x=1/../y" "http://a/b/c/y" ,base-uri)
|
||||
("g?y/./x" "http://a/b/c/g?y/./x" ,base-uri)
|
||||
("g?y/../x" "http://a/b/c/g?y/../x" ,base-uri)
|
||||
("g#s/./x" "http://a/b/c/g#s/./x" ,base-uri)
|
||||
("g#s/../x" "http://a/b/c/g#s/../x" ,base-uri)
|
||||
("http:g" "http:g" ,base-uri)
|
||||
|
||||
("foo/bar/baz.htm#foo"
|
||||
"http://a/b/foo/bar/baz.htm#foo"
|
||||
"http://a/b/c.htm")
|
||||
("foo/bar/baz.htm#foo"
|
||||
"http://a/b/foo/bar/baz.htm#foo"
|
||||
"http://a/b/")
|
||||
("foo/bar/baz.htm#foo"
|
||||
"http://a/foo/bar/baz.htm#foo"
|
||||
"http://a/b")
|
||||
("foo/bar;x;y/bam.htm"
|
||||
"http://a/b/c/foo/bar;x;y/bam.htm"
|
||||
"http://a/b/c/")))
|
||||
(push `(util.test:test (intern-uri ,(second x))
|
||||
(intern-uri (merge-uris (intern-uri ,(first x))
|
||||
(intern-uri ,(third x))))
|
||||
:test 'uri=)
|
||||
res))
|
||||
|
||||
;;;; intern tests
|
||||
(dolist (x '(;; default port and specifying the default port are
|
||||
;; supposed to compare the same:
|
||||
("http://www.franz.com:80" "http://www.franz.com")
|
||||
("http://www.franz.com:80" "http://www.franz.com" eq)
|
||||
;; make sure they're `eq':
|
||||
("http://www.franz.com:80" "http://www.franz.com" eq)
|
||||
("http://www.franz.com" "http://www.franz.com" eq)
|
||||
("http://www.franz.com/foo" "http://www.franz.com/foo" eq)
|
||||
("http://www.franz.com/foo?bar"
|
||||
"http://www.franz.com/foo?bar" eq)
|
||||
("http://www.franz.com/foo?bar#baz"
|
||||
"http://www.franz.com/foo?bar#baz" eq)
|
||||
("http://WWW.FRANZ.COM" "http://www.franz.com" eq)
|
||||
("http://www.FRANZ.com" "http://www.franz.com" eq)
|
||||
("http://www.franz.com" "http://www.franz.com/" eq)
|
||||
(;; %72 is "r", %2f is "/", %3b is ";"
|
||||
"http://www.franz.com/ba%72%2f%3b;x;y;z/baz/"
|
||||
"http://www.franz.com/bar%2f%3b;x;y;z/baz/" eq)))
|
||||
(push `(util.test:test (intern-uri ,(second x))
|
||||
(intern-uri ,(first x))
|
||||
:test ',(if (third x)
|
||||
(third x)
|
||||
'uri=))
|
||||
res))
|
||||
|
||||
;;;; parsing and equivalence tests
|
||||
(push `(util.test:test
|
||||
(parse-uri "http://foo+bar?baz=b%26lob+bof")
|
||||
(parse-uri (parse-uri "http://foo+bar?baz=b%26lob+bof"))
|
||||
:test 'uri=)
|
||||
res)
|
||||
(push '(util.test:test
|
||||
(parse-uri "http://www.foo.com")
|
||||
(parse-uri (parse-uri "http://www.foo.com?")) ; allow ? at end
|
||||
:test 'uri=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"baz=b%26lob+bof"
|
||||
(uri-query (parse-uri "http://foo+bar?baz=b%26lob+bof"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"baz=b%26lob+bof%3d"
|
||||
(uri-query (parse-uri "http://foo+bar?baz=b%26lob+bof%3d"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test (parse-uri "xxx?%41") (parse-uri "xxx?A") :test 'uri=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "A" (uri-query (parse-uri "xxx?%41")) :test 'string=)
|
||||
res)
|
||||
|
||||
(push `(util.test:test-error (parse-uri " ")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "foo ")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri " foo ")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "<foo")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "foo>")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "<foo>")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "%")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "foo%xyr")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "\"foo\"")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test "%20" (format nil "~a" (parse-uri "%20"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test "&" (format nil "~a" (parse-uri "%26"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "foo%23bar" (format nil "~a" (parse-uri "foo%23bar"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "foo%23bar#foobar"
|
||||
(format nil "~a" (parse-uri "foo%23bar#foobar"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "foo%23bar#foobar#baz"
|
||||
(format nil "~a" (parse-uri "foo%23bar#foobar#baz"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "foo%23bar#foobar#baz"
|
||||
(format nil "~a" (parse-uri "foo%23bar#foobar%23baz"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push
|
||||
`(util.test:test "foo%23bar#foobar/baz"
|
||||
(format nil "~a" (parse-uri "foo%23bar#foobar%2fbaz"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "foobar??")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "foobar?foo?")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test "foobar?%3f"
|
||||
(format nil "~a" (parse-uri "foobar?%3f"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"http://foo/bAr;3/baz?baf=3"
|
||||
(format nil "~a" (parse-uri "http://foo/b%41r;3/baz?baf=3"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
'(:absolute ("/bAr" "3") "baz")
|
||||
(uri-parsed-path (parse-uri "http://foo/%2fb%41r;3/baz?baf=3"))
|
||||
:test 'equal)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"/%2fbAr;3/baz"
|
||||
(let ((u (parse-uri "http://foo/%2fb%41r;3/baz?baf=3")))
|
||||
(setf (uri-parsed-path u) '(:absolute ("/bAr" "3") "baz"))
|
||||
(uri-path u))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"http://www.verada.com:8010/kapow?name=foo%3Dbar%25"
|
||||
(format nil "~a"
|
||||
(parse-uri
|
||||
"http://www.verada.com:8010/kapow?name=foo%3Dbar%25"))
|
||||
:test 'string=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
"ftp://parcftp.xerox.com/pub/pcl/mop/"
|
||||
(format nil "~a"
|
||||
(parse-uri "ftp://parcftp.xerox.com:/pub/pcl/mop/"))
|
||||
:test 'string=)
|
||||
res)
|
||||
|
||||
;;;; enough-uri tests
|
||||
(dolist (x `(("http://www.franz.com/foo/bar/baz.htm"
|
||||
"http://www.franz.com/foo/bar/"
|
||||
"baz.htm")
|
||||
("http://www.franz.com/foo/bar/baz.htm"
|
||||
"http://www.franz.com/foo/bar"
|
||||
"baz.htm")
|
||||
("http://www.franz.com:80/foo/bar/baz.htm"
|
||||
"http://www.franz.com:80/foo/bar"
|
||||
"baz.htm")
|
||||
("http:/foo/bar/baz.htm" "http:/foo/bar" "baz.htm")
|
||||
("http:/foo/bar/baz.htm" "http:/foo/bar/" "baz.htm")
|
||||
("/foo/bar/baz.htm" "/foo/bar" "baz.htm")
|
||||
("/foo/bar/baz.htm" "/foo/bar/" "baz.htm")
|
||||
("/foo/bar/baz.htm#foo" "/foo/bar/" "baz.htm#foo")
|
||||
("/foo/bar/baz.htm?bar#foo" "/foo/bar/" "baz.htm?bar#foo")
|
||||
|
||||
("http://www.dnai.com/~layer/foo.htm"
|
||||
"http://www.known.net"
|
||||
"http://www.dnai.com/~layer/foo.htm")
|
||||
("http://www.dnai.com/~layer/foo.htm"
|
||||
"http://www.dnai.com:8000/~layer/"
|
||||
"http://www.dnai.com/~layer/foo.htm")
|
||||
("http://www.dnai.com:8000/~layer/foo.htm"
|
||||
"http://www.dnai.com/~layer/"
|
||||
"http://www.dnai.com:8000/~layer/foo.htm")
|
||||
("http://www.franz.com"
|
||||
"http://www.franz.com"
|
||||
"/")))
|
||||
(push `(util.test:test (parse-uri ,(third x))
|
||||
(enough-uri (parse-uri ,(first x))
|
||||
(parse-uri ,(second x)))
|
||||
:test 'uri=)
|
||||
res))
|
||||
|
||||
;;;; urn tests, ideas of which are from rfc2141
|
||||
(let ((urn "urn:com:foo-the-bar"))
|
||||
(push `(util.test:test "com" (urn-nid (parse-uri ,urn))
|
||||
:test #'string=)
|
||||
res)
|
||||
(push `(util.test:test "foo-the-bar" (urn-nss (parse-uri ,urn))
|
||||
:test #'string=)
|
||||
res))
|
||||
(push `(util.test:test-error (parse-uri "urn:")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "urn:foo")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "urn:foo$")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "urn:foo_")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test-error (parse-uri "urn:foo:foo&bar")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
(push `(util.test:test (parse-uri "URN:foo:a123,456")
|
||||
(parse-uri "urn:foo:a123,456")
|
||||
:test #'uri=)
|
||||
res)
|
||||
(push `(util.test:test (parse-uri "URN:foo:a123,456")
|
||||
(parse-uri "urn:FOO:a123,456")
|
||||
:test #'uri=)
|
||||
res)
|
||||
(push `(util.test:test (parse-uri "urn:foo:a123,456")
|
||||
(parse-uri "urn:FOO:a123,456")
|
||||
:test #'uri=)
|
||||
res)
|
||||
(push `(util.test:test (parse-uri "URN:FOO:a123%2c456")
|
||||
(parse-uri "urn:foo:a123%2C456")
|
||||
:test #'uri=)
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:A123,456")
|
||||
(parse-uri "urn:FOO:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:A123,456")
|
||||
(parse-uri "urn:foo:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:A123,456")
|
||||
(parse-uri "URN:foo:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:a123%2C456")
|
||||
(parse-uri "urn:FOO:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:a123%2C456")
|
||||
(parse-uri "urn:foo:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "URN:FOO:a123%2c456")
|
||||
(parse-uri "urn:foo:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:FOO:a123%2c456")
|
||||
(parse-uri "urn:foo:a123,456")))
|
||||
res)
|
||||
(push `(util.test:test
|
||||
nil
|
||||
(uri= (parse-uri "urn:foo:a123%2c456")
|
||||
(parse-uri "urn:foo:a123,456")))
|
||||
res)
|
||||
|
||||
(push `(util.test:test t
|
||||
(uri= (parse-uri "foo") (parse-uri "foo#")))
|
||||
res)
|
||||
|
||||
(push
|
||||
'(let ((net.uri::*strict-parse* nil))
|
||||
(util.test:test-no-error
|
||||
(net.uri:parse-uri
|
||||
"http://foo.com/bar?a=zip|zop")))
|
||||
res)
|
||||
(push
|
||||
'(util.test:test-error
|
||||
(net.uri:parse-uri "http://foo.com/bar?a=zip|zop")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
|
||||
(push
|
||||
'(let ((net.uri::*strict-parse* nil))
|
||||
(util.test:test-no-error
|
||||
(net.uri:parse-uri
|
||||
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041")))
|
||||
res)
|
||||
(push
|
||||
'(util.test:test-error
|
||||
(net.uri:parse-uri
|
||||
"http://arc3.msn.com/ADSAdClient31.dll?GetAd?PG=NBCSBU?SC=D2?AN=1.0586041")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
|
||||
(push
|
||||
'(let ((net.uri::*strict-parse* nil))
|
||||
(util.test:test-no-error
|
||||
(net.uri:parse-uri
|
||||
"http://scbc.booksonline.com/cgi-bin/ndCGI.exe/Develop/pagClubHome.hrfTIOLI_onWebEvent(hrfTIOLI)?selGetClubOffer.TB_OFFER_ID_OFFER=344879%2e0&selGetClubOffer.TB_OFFER_ID_ITEM=34487%2e0&selGetClubOffer.TB_OFFER_ID_OFFER=344879%2e0&^CSpCommand.currRowNumber=5&hrfTIOLI=The+Visual+Basic+6+Programmer%27s+Toolkit&SPIDERSESSION=%3f%3f%3f%3f%3f%5f%3f%3f%3f%40%5b%3f%3f%3f%3fBOs%5cH%3f%3f%3f%3f%3f%3f%3f%3f%3fMMpXO%5f%40JG%7d%40%5c%5f%3f%3f%3fECK%5dt%3fLDT%3fTBD%3fDDTxPEToBS%40%5f%5dBDgXVoKBSDs%7cDT%3fK%3fd%3fTIb%7ceHbkeMfh%60LRpO%5cact%5eUC%7bMu%5fyWUGzLUhP%5ebpdWRka%5dFO%3f%5dBopW%3f%40HMrxbMRd%60LOpuMVga%3fv%3fTS%3fpODT%40O&%5euniqueValue=977933764843")))
|
||||
res)
|
||||
(push
|
||||
'(util.test:test-error
|
||||
(net.uri:parse-uri
|
||||
"http://scbc.booksonline.com/cgi-bin/ndCGI.exe/Develop/pagClubHome.hrfTIOLI_onWebEvent(hrfTIOLI)?selGetClubOffer.TB_OFFER_ID_OFFER=344879%2e0&selGetClubOffer.TB_OFFER_ID_ITEM=34487%2e0&selGetClubOffer.TB_OFFER_ID_OFFER=344879%2e0&^CSpCommand.currRowNumber=5&hrfTIOLI=The+Visual+Basic+6+Programmer%27s+Toolkit&SPIDERSESSION=%3f%3f%3f%3f%3f%5f%3f%3f%3f%40%5b%3f%3f%3f%3fBOs%5cH%3f%3f%3f%3f%3f%3f%3f%3f%3fMMpXO%5f%40JG%7d%40%5c%5f%3f%3f%3fECK%5dt%3fLDT%3fTBD%3fDDTxPEToBS%40%5f%5dBDgXVoKBSDs%7cDT%3fK%3fd%3fTIb%7ceHbkeMfh%60LRpO%5cact%5eUC%7bMu%5fyWUGzLUhP%5ebpdWRka%5dFO%3f%5dBopW%3f%40HMrxbMRd%60LOpuMVga%3fv%3fTS%3fpODT%40O&%5euniqueValue=977933764843")
|
||||
:condition-type 'parse-error)
|
||||
res)
|
||||
|
||||
`(progn ,@(nreverse res)))
|
||||
)
|
||||
|
||||
(eval
|
||||
`(with-tests (:name "puri")
|
||||
,@*tests*))
|
||||
Reference in New Issue
Block a user