Changeset 10063


Ignore:
Timestamp:
09/29/05 01:22:03 (16 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/tests/pathname-tests.lisp

    r10062 r10063  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: pathname-tests.lisp,v 1.35 2005-09-28 18:55:23 piso Exp $
     4;;; $Id: pathname-tests.lisp,v 1.36 2005-09-29 01:22:03 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    8585    (unless (eq (pathname-device pathname) :unspecific)
    8686      (setf ok nil))
    87     (unless (and (or (not (stringp host))
    88                      (funcall test host expected-host))
     87    (unless (and (funcall test (if (stringp host) host
     88                                    (host-namestring pathname))
     89                          expected-host)
    8990                 (funcall test directory expected-directory)
    9091                 (funcall test name expected-name)
     
    575576;; PARSE-NAMESTRING
    576577(deftest parse-namestring.1
    577   (typep (parse-namestring "foo.bar" "effluvia") 'logical-pathname)
     578  #-allegro
     579  (check-logical-pathname (parse-namestring "effluvia:foo.bar")
     580                          "EFFLUVIA" '(:absolute) "FOO" "BAR" nil)
     581  #+allegro
     582  (check-logical-pathname (parse-namestring "effluvia:foo.bar")
     583                          "effluvia" nil "foo" "bar" nil)
    578584  t)
    579585
    580586(deftest parse-namestring.2
    581   (check-namestring (parse-namestring "foo.bar" "effluvia")
    582                     #-(or allegro lispworks) "EFFLUVIA:FOO.BAR"
    583                     #+allegro "effluvia:foo.bar"
    584                     #+lispworks "effluvia:FOO.BAR")
     587  #-allegro
     588  (check-logical-pathname (parse-namestring "foo.bar" "effluvia")
     589                          "EFFLUVIA" '(:absolute) "FOO" "BAR" nil)
     590  #+allegro
     591  (check-logical-pathname (parse-namestring "foo.bar" "effluvia")
     592                          "effluvia" nil "foo" "bar" nil)
     593  t)
     594
     595(deftest parse-namestring.3
     596  #-allegro
     597  (check-logical-pathname (parse-namestring "foo;bar;baz.fas.3" "effluvia")
     598                          "EFFLUVIA" '(:absolute "FOO" "BAR") "BAZ" "FAS" 3)
     599  #+allegro
     600  (check-logical-pathname (parse-namestring "foo;bar;baz.fas.3" "effluvia")
     601                          "effluvia" '(:absolute "foo" "bar") "baz" "fas" nil)
     602  t)
     603
     604#-cmu ;; Search list.
     605(deftest parse-namestring.4
     606  #-(or abcl clisp)
     607  (check-physical-pathname (parse-namestring "effluvia:foo.bar" "")
     608                           nil "effluvia:foo" "bar")
     609  #+abcl
     610  ;; Invalid logical host name: ""
     611  (signals-error (parse-namestring "effluvia:foo.bar" "") 'error)
     612  #+clisp
     613  ;; Host mismatch.
     614  (signals-error (parse-namestring "effluvia:foo.bar" "") 'error)
     615  t)
     616
     617;; "If host is nil and thing is a syntactically valid logical pathname
     618;; namestring containing an explicit host, then it is parsed as a logical
     619;; pathname namestring."
     620(deftest parse-namestring.5
     621  #-allegro
     622  (check-logical-pathname (parse-namestring "effluvia:foo.bar" nil)
     623                          "EFFLUVIA" '(:absolute) "FOO" "BAR" nil)
     624  #+allegro
     625  (check-logical-pathname (parse-namestring "effluvia:foo.bar" nil)
     626                          "effluvia" nil "foo" "bar" nil)
     627  t)
     628
     629;; "If host is nil, default-pathname is a logical pathname, and thing is a
     630;; syntactically valid logical pathname namestring without an explicit host,
     631;; then it is parsed as a logical pathname namestring on the host that is the
     632;; host component of default-pathname."
     633(deftest parse-namestring.6
     634  #-allegro
     635  (check-logical-pathname (parse-namestring "foo" nil #p"effluvia:bar")
     636                          "EFFLUVIA" '(:absolute) "FOO" nil nil)
     637  #+allegro
     638  (check-logical-pathname (parse-namestring "foo" nil #p"effluvia:bar")
     639                          "effluvia" nil "foo" nil nil)
     640  t)
     641
     642;; This amounts to the same thing as PARSE-NAMESTRING.6, since DEFAULT-PATHNAME
     643;; defaults to the value of *DEFAULT-PATHNAME-DEFAULTS*.
     644(deftest parse-namestring.7
     645  (let ((*default-pathname-defaults* #p"effluvia:bar"))
     646    #-allegro
     647    (check-logical-pathname (parse-namestring "foo" nil)
     648                            "EFFLUVIA" '(:absolute) "FOO" nil nil)
     649    #+allegro
     650    (check-logical-pathname (parse-namestring "foo" nil #p"effluvia:bar")
     651                            "effluvia" nil "foo" nil nil))
    585652  t)
    586653
Note: See TracChangeset for help on using the changeset viewer.