Changeset 35367 in project


Ignore:
Timestamp:
03/31/18 19:46:29 (6 months ago)
Author:
kon
Message:

compiled test will have 3 directory items (itself), fix compiler cleverness (just because ".." is a string doesn't make it a visible filename)

Location:
release/4/directory-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/directory-utils/trunk/directory-utils.scm

    r35366 r35367  
    9999(define-check+error-type directory)
    100100
     101;NOTE do not type these as 'predicate'
     102;ex: (: filename? (* -> boolean : filename))
     103;since the compiler will treat a literal ".." as
     104;meeting the criteria at compile time!
     105
    101106;; A null pathname or only extension is not a pathname, here at least
    102107
    103108; detecting only an extension is impossible with string pathnames
    104109
    105 (: pathname? (* -> boolean : pathname))
    106 ;
    107 (define (pathname? obj)
     110(define: (pathname? (obj *)) --> boolean
    108111  (and
    109112    (string? obj)
     
    115118;; Just a filename, no directory
    116119
    117 (: filename? (* -> boolean : filename))
    118 ;
    119 (define (filename? obj)
     120(define: (filename? (obj *)) --> boolean
    120121  (and
    121122    (string? obj)
     
    127128;;
    128129
    129 (: dot-filename? (* -> boolean : filename))
    130 ;
    131 (define (dot-filename? obj)
     130(define: (dot-filename? (obj *)) --> boolean
    132131  (and
    133132    (filename? obj)
    134133    (dot-filename-prefix? obj)) )
    135134
    136 ;; Any pathname component is a dot-filename?
    137 
    138 (: dot-pathname? (* -> boolean : pathname))
    139 ;
    140 (define (dot-pathname? obj)
     135;; Is any pathname component is a dot-filename?
     136
     137(define: (dot-pathname? (obj *)) --> boolean
    141138  (and
    142139    (string? obj)
  • release/4/directory-utils/trunk/tests/directory-utils-test.scm

    r35366 r35367  
    3030(test-assert (not (which-command-pathnames "93274030#$%)#)$()")))
    3131
    32 (test "directory-fold" 2 (directory-fold (lambda (fn ct) (fx+ ct 1) ) 0 "." #:dotfiles? #f))
     32(cond-expand
     33  (compiling (define-constant TESTS-DIRECTORY-COUNT 3))
     34  (else (define-constant TESTS-DIRECTORY-COUNT 2)) )
     35
     36(test "directory-fold"
     37  TESTS-DIRECTORY-COUNT
     38  (directory-fold (lambda (fn ct) (fx+ ct 1) ) 0 "." #:dotfiles? #f))
    3339
    3440(test-assert (push-directory ".."))
Note: See TracChangeset for help on using the changeset viewer.