Megatest

Artifact [f3fe558fbc]
Login

Artifact f3fe558fbca386ee42b710b4eef4bdbc93e2d178:


(use test posix srfi-1)
(load "path-glob.scm")

(define globbers `((multi-glob . ,multi-glob)(path-glob . ,path-glob)))
(define interesting-patts '("../*/*" "/*/bin/*" "./*/bin/*"))
(define simple-patts '("../*" "/*" "/bin/*" "." ".." "*"))

(define (trim-list lst)
  (if (> (length lst) 3)
      (append (take lst 3) '(...))
      lst))

(define (generate-prefix patt)
  (write (conc "patt: " patt (make-string (- 10 (string-length patt)) #\ ))))

(print "\nCompare each globber with glob") ;; can only do one level globs here
(for-each
 (lambda (globber)
   (print "\n\nGlobber: " globber)
   (for-each
    (lambda (patt)
      (generate-prefix patt)
      (test #f '() (trim-list
		    (lset-xor string=? ((alist-ref globber globbers) patt)(glob patt)))))
    simple-patts))
 (map car globbers))

(print "\nTest the globbers against patts - only checks for resiliance, not correctness.")
(for-each
 (lambda (patt)
   (generate-prefix patt)(test #f #t (list? (path-glob patt)))
   (generate-prefix patt)(test #f #t (list? (multi-glob patt)))
   )
 interesting-patts)

(print "Compare the globbers")
(for-each
 (lambda (patt)
   (generate-prefix patt)
   (test #f '() (trim-list
		 (lset-xor string=? (path-glob patt)(multi-glob patt)))))
 interesting-patts)

(test-exit)