~ chicken-core (chicken-5) /tests/version-tests.scm
Trap1(import chicken.irregex chicken.platform chicken.keyword chicken.string)23(let* ((version-tokens (string-split (chicken-version) "."))4 (major (string->number (car version-tokens)))5 (minor (string->number (cadr version-tokens))))67 (display "Checking major and minor version numbers against chicken-version... ")8 (assert (= (foreign-value "C_MAJOR_VERSION" int) major))9 (assert (= (foreign-value "C_MINOR_VERSION" int) minor))10 (print "ok")1112 (display "Checking the registered feature chicken-<major>.<minor>... ")13 (let loop ((features (features)))14 (if (null? features)15 (error "Could not find feature chicken-<major>.<minor>")16 (let ((feature (keyword->string (car features))))17 (cond ((irregex-match "chicken-(\\d+)\\.(\\d+)" feature)18 => (lambda (match)19 (assert (= (string->number20 (irregex-match-substring match 1))21 major))22 (assert (= (string->number23 (irregex-match-substring match 2))24 minor))))25 (else (loop (cdr features)))))))2627 (display "Checking the registered feature chicken-<major>... ")28 (let loop ((features (features)))29 (if (null? features)30 (error "Could not find feature chicken-<major>")31 (let ((feature (keyword->string (car features))))32 (cond ((irregex-match "chicken-(\\d+)" feature)33 => (lambda (match)34 (assert (= (string->number35 (irregex-match-substring match 1))36 major))))37 (else (loop (cdr features)))))))38 (print "ok"))