Changeset 10016


Ignore:
Timestamp:
09/23/05 23:38:44 (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

    r10015 r10016  
    357357  (typep (parse-namestring "**;*.*.*" "effluvia") 'logical-pathname)
    358358  t)
     359(deftest logical.7
     360  (check-namestring (parse-namestring "**;*.*.*" "effluvia")
     361                    #-allegro "EFFLUVIA:**;*.*.*"
     362                    ;; Allegro preserves case and drops the version component.
     363                    #+allegro "effluvia:**;*.*")
     364  t)
     365
    359366#-allegro
    360 (expect (string= (namestring (parse-namestring "**;*.*.*" "effluvia")) "EFFLUVIA:**;*.*.*"))
    361 #+allegro
    362 ;; Allegro preserves case and drops the version component.
    363 (expect (string= (namestring (parse-namestring "**;*.*.*" "effluvia")) "effluvia:**;*.*"))
    364 
    365367;; The version can be a bignum.
    366 ;; (setf *pathname* (pathname "effluvia:bar.baz.2147483648"))
    367 #-allegro
    368 (check-logical-pathname #p"effluvia:bar.baz.2147483648" "EFFLUVIA" '(:absolute) "BAR" "BAZ" 2147483648)
    369 ;;(expect (= (pathname-version #p"effluvia:bar.baz.2147483648") 2147483648))
     368(deftest logical.8
     369  (check-logical-pathname #p"effluvia:bar.baz.2147483648" "EFFLUVIA" '(:absolute) "BAR" "BAZ" 2147483648)
     370  t)
    370371#-(or sbcl allegro)
    371372;; SBCL has a bug when the version is a bignum.
    372 (expect (string= (namestring #p"effluvia:bar.baz.2147483648")
    373                  "EFFLUVIA:BAR.BAZ.2147483648"))
    374 
    375 #-allegro
    376 (check-logical-pathname #p"effluvia:foo.*" "EFFLUVIA" '(:absolute) "FOO" :wild nil)
    377 #+allegro
    378 (check-logical-pathname #p"effluvia:foo.*" "effluvia" nil "foo" :wild nil)
    379 
    380 #-allegro
    381 (check-logical-pathname #p"effluvia:*.lisp" "EFFLUVIA" '(:absolute) :wild "LISP" nil)
    382 #+allegro
    383 (check-logical-pathname #p"effluvia:*.lisp" "effluvia" nil :wild "lisp" nil)
    384 
    385 #-allegro
    386 (check-logical-pathname #p"effluvia:bar.baz.newest" "EFFLUVIA" '(:absolute) "BAR" "BAZ" :newest)
    387 #+allegro
    388 (check-logical-pathname #p"effluvia:bar.baz.newest" "effluvia" nil "bar" "baz" nil)
    389 
    390 #-allegro
    391 (check-logical-pathname #p"EFFLUVIA:BAR.BAZ.NEWEST" "EFFLUVIA" '(:absolute) "BAR" "BAZ" :newest)
    392 #+allegro
    393 (check-logical-pathname #p"EFFLUVIA:BAR.BAZ.NEWEST" "EFFLUVIA" nil "BAR" "BAZ" nil)
     373(deftest logical.9
     374  (check-namestring #p"effluvia:bar.baz.2147483648" "EFFLUVIA:BAR.BAZ.2147483648")
     375  t)
     376
     377(deftest logical.10
     378  #-allegro
     379  (check-logical-pathname #p"effluvia:foo.*" "EFFLUVIA" '(:absolute) "FOO" :wild nil)
     380  #+allegro
     381  (check-logical-pathname #p"effluvia:foo.*" "effluvia" nil "foo" :wild nil)
     382  t)
     383
     384(deftest logical.11
     385  #-allegro
     386  (check-logical-pathname #p"effluvia:*.lisp" "EFFLUVIA" '(:absolute) :wild "LISP" nil)
     387  #+allegro
     388  (check-logical-pathname #p"effluvia:*.lisp" "effluvia" nil :wild "lisp" nil)
     389  t)
     390
     391(deftest logical.12
     392  #-allegro
     393  (check-logical-pathname #p"effluvia:bar.baz.newest" "EFFLUVIA" '(:absolute) "BAR" "BAZ" :newest)
     394  #+allegro
     395  (check-logical-pathname #p"effluvia:bar.baz.newest" "effluvia" nil "bar" "baz" nil)
     396  t)
     397
     398(deftest logical.13
     399  #-allegro
     400  (check-logical-pathname #p"EFFLUVIA:BAR.BAZ.NEWEST" "EFFLUVIA" '(:absolute) "BAR" "BAZ" :newest)
     401  #+allegro
     402  (check-logical-pathname #p"EFFLUVIA:BAR.BAZ.NEWEST" "EFFLUVIA" nil "BAR" "BAZ" nil)
     403  t)
    394404
    395405;; The directory component.
    396 (check-logical-pathname #p"effluvia:foo;bar.baz" "EFFLUVIA" '(:absolute "FOO") "BAR" "BAZ" nil)
    397 #-allegro
    398 (expect (string= (namestring #p"effluvia:foo;bar.baz") "EFFLUVIA:FOO;BAR.BAZ"))
    399 #+allegro
    400 (expect (string= (namestring #p"effluvia:foo;bar.baz") "effluvia:foo;bar.baz"))
    401 
    402 #-allegro
    403 (progn
     406(deftest logical.14
     407  (check-logical-pathname #p"effluvia:foo;bar.baz" "EFFLUVIA" '(:absolute "FOO") "BAR" "BAZ" nil)
     408  t)
     409
     410(deftest logical.15
     411  (check-namestring #p"effluvia:foo;bar.baz"
     412                    #-allegro "EFFLUVIA:FOO;BAR.BAZ"
     413                    #+allegro "effluvia:foo;bar.baz")
     414  t)
     415
     416(deftest logical.16
     417  #-allegro
    404418  (check-logical-pathname #p"effluvia:;bar.baz" "EFFLUVIA" '(:relative) "BAR" "BAZ" nil)
    405   (expect (string= (namestring #p"effluvia:;bar.baz") "EFFLUVIA:;BAR.BAZ")))
    406 #+allegro
    407 ;; Allegro drops the directory component and removes the semicolon from the
    408 ;; namestring.
    409 (progn
     419  #+allegro
     420  ;; Allegro drops the directory component and removes the semicolon from the
     421  ;; namestring.
    410422  (check-logical-pathname #p"effluvia:;bar.baz" "EFFLUVIA" nil "BAR" "BAZ" nil)
    411   (expect (string= (namestring #p"effluvia:;bar.baz") "effluvia:bar.baz")))
     423  t)
     424(deftest logical.17
     425  (check-namestring #p"effluvia:;bar.baz"
     426                    #+allegro "effluvia:bar.baz"
     427                    #-allegro "EFFLUVIA:;BAR.BAZ")
     428  t)
    412429
    413430;; "If a relative-directory-marker precedes the directories, the directory
    414431;; component parsed is as relative; otherwise, the directory component is
    415432;; parsed as absolute."
    416 #-allegro
    417 (expect (equal (pathname-directory #p"effluvia:foo.baz") '(:absolute)))
    418 #+allegro
    419 (expect (equal (pathname-directory #p"effluvia:foo.baz") nil))
    420 
    421 (expect (typep  #p"effluvia:" 'logical-pathname))
    422 #-allegro
    423 (expect (equal (pathname-directory #p"effluvia:") '(:absolute)))
    424 #+allegro
    425 (expect (equal (pathname-directory #p"effluvia:") nil))
     433(deftest logical.18
     434  (equal (pathname-directory #p"effluvia:foo.baz")
     435         #-allegro '(:absolute)
     436         #+allegro nil)
     437  t)
     438
     439(deftest logical.19
     440  (typep  #p"effluvia:" 'logical-pathname)
     441  t)
     442
     443(deftest logical.20
     444  (equal (pathname-directory #p"effluvia:")
     445         #-allegro '(:absolute)
     446         #+allegro nil)
     447  t)
    426448
    427449;; PARSE-NAMESTRING
    428 (expect (typep (parse-namestring "foo.bar" "effluvia") 'logical-pathname))
    429 #-allegro
    430 (expect (string= (namestring (parse-namestring "foo.bar" "effluvia")) "EFFLUVIA:FOO.BAR"))
    431 #+allegro
    432 (expect (string= (namestring (parse-namestring "foo.bar" "effluvia")) "effluvia:foo.bar"))
     450(deftest parse-namestring.1
     451  (typep (parse-namestring "foo.bar" "effluvia") 'logical-pathname)
     452  t)
     453
     454(deftest parse-namestring.2
     455  (check-namestring (parse-namestring "foo.bar" "effluvia")
     456                    #-allegro "EFFLUVIA:FOO.BAR"
     457                    #+allegro "effluvia:foo.bar")
     458  t)
    433459
    434460;; WILD-PATHNAME-P
    435 (expect (wild-pathname-p #p"effluvia:;*.baz"))
     461(deftest wild-pathname-p.1
     462  (wild-pathname-p #p"effluvia:;*.baz")
     463  #+(or cmu sbcl) (:wild :wild-inferiors)
     464  #-(or cmu sbcl) t)
    436465
    437466;; PATHNAME-MATCH-P
    438 (expect (pathname-match-p "/foo/bar/baz" "/*/*/baz"))
    439 (expect (pathname-match-p "/foo/bar/baz" "/**/baz"))
    440 (expect (pathname-match-p "/foo/bar/quux/baz" "/**/baz"))
    441 (expect (pathname-match-p "foo.bar" "/**/*.*"))
    442 (expect (pathname-match-p "/usr/local/bin/foo.bar" "/**/foo.bar"))
    443 (expect (not (pathname-match-p "/usr/local/bin/foo.bar" "**/foo.bar")))
    444 (expect (pathname-match-p "/foo/bar.txt" "/**/*.*"))
    445 (expect (not (pathname-match-p "/foo/bar.txt" "**/*.*")))
    446 (expect (pathname-match-p #p"effluvia:foo.bar" #p"effluvia:**;*.*.*"))
     467(deftest pathname-match-p.1
     468  (pathname-match-p "/foo/bar/baz" "/*/*/baz")
     469  t)
     470(deftest pathname-match-p.2
     471  (pathname-match-p "/foo/bar/baz" "/**/baz")
     472  t)
     473(deftest pathname-match-p.3
     474  (pathname-match-p "/foo/bar/quux/baz" "/**/baz")
     475  t)
     476(deftest pathname-match-p.4
     477  (pathname-match-p "foo.bar" "/**/*.*")
     478  t)
     479(deftest pathname-match-p.5
     480  (pathname-match-p "/usr/local/bin/foo.bar" "/**/foo.bar")
     481  t)
     482(deftest pathname-match-p.6
     483  (pathname-match-p "/usr/local/bin/foo.bar" "**/foo.bar")
     484  nil)
     485(deftest pathname-match-p.7
     486  (pathname-match-p "/foo/bar.txt" "/**/*.*")
     487  t)
     488(deftest pathname-match-p.8
     489  (pathname-match-p "/foo/bar.txt" "**/*.*")
     490  nil)
     491(deftest pathname-match-p.9
     492  (pathname-match-p #p"effluvia:foo.bar" #p"effluvia:**;*.*.*")
     493  t)
    447494
    448495;; TRANSLATE-PATHNAME
     
    500547
    501548;; "TRANSLATE-PATHNAME translates SOURCE (that matches FROM-WILDCARD)..."
    502 (deftest pathname-match-p.1
     549(deftest pathname-match-p.10
    503550  (pathname-match-p "/foo/bar.txt" "**/*.*")
    504551  nil)
     
    514561  t)
    515562
    516 (deftest pathname-match-p.2
     563(deftest pathname-match-p.11
    517564  (pathname-match-p "/foo/bar.txt" "/**/*.*")
    518565  t)
Note: See TracChangeset for help on using the changeset viewer.