Changeset 38969 in project


Ignore:
Timestamp:
08/30/20 22:51:12 (4 weeks ago)
Author:
Kon Lovett
Message:

add -strict-types, remove redundant -local, type is interface, update test runner

Location:
release/5/locale/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/locale/trunk/locale-timezone.scm

    r38483 r38969  
    1616(import (chicken foreign))
    1717(import (chicken keyword))
    18 (import (only (chicken time posix)
    19   time->string
    20   seconds->local-time local-time->seconds))
     18(import (only (chicken fixnum) most-negative-fixnum))
     19(import (only (chicken time posix) time->string seconds->local-time local-time->seconds))
    2120(import (only (chicken process-context)
    2221  get-environment-variable
     
    7069  (let (
    7170    (argcnt (length args))
    72     (yr #f) (mo #f) (dy #f) (hr #f) (mn #f) (sc #f) (dst? #f) )
     71    (yr most-negative-fixnum) ;type compatible, but invalid, initial values
     72    (mo most-negative-fixnum)
     73    (dy most-negative-fixnum)
     74    (hr most-negative-fixnum)
     75    (mn most-negative-fixnum)
     76    (sc most-negative-fixnum)
     77    (dst? #f) )
    7378    ;
    7479    (define (kwdarg kwd rest)
  • release/5/locale/trunk/locale.egg

    r38483 r38969  
    77 (author "[[kon lovett]]")
    88 (license "BSD")
    9  (dependencies
    10         (srfi-1 "0.5")
    11         (srfi-13 "0.2")
    12         (regex "2.0")
    13         (check-errors "3.1.0"))
     9 (dependencies srfi-1 srfi-13 regex check-errors)
    1410 (test-dependencies test)
    1511 (components
    1612  (extension locale-components
    1713    (types-file)
    18     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     14    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    1915  (extension locale-categories
    2016    (types-file)
    2117    (component-dependencies locale-components)
    22     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     18    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    2319  (extension locale-posix
    2420    (types-file)
    2521    (component-dependencies locale-categories locale-components)
    26     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     22    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    2723  (extension locale-timezone
    2824    (types-file)
    29     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     25    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    3026  (extension locale-builtin
    3127    (types-file)
     
    3430      locale-categories locale-components
    3531      locale-timezone)
    36     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     32    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    3733  (extension locale-current
    3834    (types-file)
     
    4036      locale-builtin locale-posix
    4137      locale-categories locale-components)
    42     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") )
     38    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") )
    4339  (extension locale
    4440    (types-file)
     
    4844      locale-timezone
    4945      locale-current)
    50     (csc-options "-O3" "-d1" "-local" "-no-procedure-checks" "-no-bound-checks") ) ) )
     46    (csc-options "-O3" "-d1" "-strict-types" "-no-procedure-checks" "-no-bound-checks") ) ) )
  • release/5/locale/trunk/tests/run.scm

    r38483 r38969  
    99;chicken-install invokes as "<csi> -s run.scm <eggnam> <eggdir>"
    1010
    11 (import (only (chicken pathname) make-pathname))
     11(import (only (chicken pathname)
     12  make-pathname pathname-file pathname-replace-directory pathname-strip-extension))
    1213(import (only (chicken process) system))
    1314(import (only (chicken process-context) argv))
    1415(import (only (chicken format) format))
     16(import (only (chicken file) file-exists? find-files))
     17(import (only (chicken irregex) irregex irregex-match?))
    1518
    16 (define (test-filename test-name)
    17   (string-append test-name "-test") )
     19(define *args* (argv))
    1820
    1921(define (egg-name args #!optional (def EGG-NAME))
    2022  (cond
    21     ((<= 4 (length *args*))
    22       (cadddr *args*) )
    23     (def
    24       def )
     23    ((<= 4 (length *args*)) (cadddr *args*) )
     24    (def                    def )
    2525    (else
    26       (error 'test "cannot determine egg-name") ) ) )
    27 
    28 ;;
    29 
    30 (define *args* (argv))
    31 (define *egg* (egg-name *args*))
    32 (define *tests* `(,*egg*))
     26      (error 'run "cannot determine egg-name") ) ) )
    3327
    3428(define *current-directory* (cond-expand (unix "./") (else #f)))
     29(define *egg* (egg-name *args*))
    3530
    3631;no -disable-interrupts or -no-lambda-info
    3732(define *csc-options* "-inline-global -local -inline \
    3833  -specialize -optimize-leaf-routines -clustering -lfa2 \
    39   -no-trace -unsafe")
     34  -no-trace -unsafe \
     35  -strict-types")
    4036
    41 (define (run-test-evaluated test-name test-source)
    42   (format #t "*** ~A - csi ***~%" test-name)
    43   (system (string-append "csi -s " test-source)) )
     37(define *test-files-rx* (irregex '(: (+ graph) #\- "test" #\. "scm")))
     38(define (test-filename name) (string-append name "-test"))
     39(define (test-files) (find-files "." #:test *test-files-rx* #:limit 1))
    4440
    45 (define (run-test-compiled test-name test-source csc-options)
    46   (format #t "*** ~A - csc ~A ***~%" test-name csc-options)
     41(define (ensure-test-source-name name)
     42  (if (irregex-match? *test-files-rx* name)
     43    name
     44    (make-pathname *current-directory* (test-filename name) "scm") ) )
     45
     46(define (run-test-evaluated source)
     47  (format #t "*** ~A - csi ***~%" (pathname-file source))
     48  (system (string-append "csi -s " source)) )
     49
     50(define (run-test-compiled source csc-options)
     51  (format #t "*** ~A - csc ~A ***~%" (pathname-file source) csc-options)
    4752  ;csc output is in current directory
    48   (system (string-append "csc" " " csc-options " " test-source))
    49   (system (make-pathname *current-directory* (test-filename test-name))) )
     53  (system (string-append "csc" " " csc-options " " source))
     54  (system (pathname-replace-directory (pathname-strip-extension source) *current-directory*)) )
    5055
    5156;;;
    5257
    53 (define (run-test #!optional (test-name *egg*) (csc-options *csc-options*))
    54   (let ((test-source (make-pathname #f (test-filename test-name) "scm")))
    55     (run-test-evaluated test-name test-source)
     58(define (run-test #!optional (name *egg*) (csc-options *csc-options*))
     59  (let (
     60    (source (ensure-test-source-name name)) )
     61    (unless (file-exists? source)
     62      (error 'run "no such file" source) )
     63    (run-test-evaluated source)
    5664    (newline)
    57     (run-test-compiled test-name test-source csc-options) ) )
     65    (run-test-compiled source csc-options) ) )
    5866
    59 (define (run-tests #!optional (test-names *tests*) (csc-options *csc-options*))
    60   (for-each (cut run-test <> csc-options) test-names) )
     67(define (run-tests #!optional (tests (test-files)) (csc-options *csc-options*))
     68  (for-each (cut run-test <> csc-options) tests) )
    6169
    6270;;; Do Test
    6371
    64 (set! *tests* (append *tests* "levenshtein-byte"))
    65 
    6672(run-tests)
Note: See TracChangeset for help on using the changeset viewer.