diff options
| author | 2025-11-01 22:29:42 -0400 | |
|---|---|---|
| committer | 2025-11-01 22:29:42 -0400 | |
| commit | 44e4fd1e1f914e5b307435769c8909da8a72aafb (patch) | |
| tree | 0c5e707c836f646229462adb08314ac8988e2d14 /tests | |
| parent | add expect-to-fail (diff) | |
Big rewrite:
1. Rename to "cuprate".
2. Remove mutexes.
3. Move rewriters to other library.
4. Move the DTO out of the `test-info` parameter. They are now separate
parameters, with the expectation that the DTO will not change over
time. This significantly reduces the complexity of the code.
5. Use SRFI-146 for Chicken.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/impl.scm | 476 | ||||
| -rw-r--r-- | tests/run.scm | 28 |
2 files changed, 217 insertions, 287 deletions
diff --git a/tests/impl.scm b/tests/impl.scm index 0395fb2..f8757cd 100644 --- a/tests/impl.scm +++ b/tests/impl.scm @@ -1,25 +1,3 @@ -#| Copyright © 2025 Peter McGoron - | - | Permission is hereby granted, free of charge, to any person obtaining - | a copy of this software and associated documentation files (the - | “Software”), to deal in the Software without restriction, including - | without limitation the rights to use, copy, modify, merge, publish, - | distribute, sublicense, and/or sell copies of the Software, and to - | permit persons to whom the Software is furnished to do so, subject to - | the following conditions: - | - | The above copyright notice and this permission notice shall be included - | in all copies or substantial portions of the Software. - | - | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, - | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - | THE USE OR OTHER DEALINGS IN THE SOFTWARE. - |# - ;;; This is a meta-test suite for Conspire, similar to the meta-test ;;; suite of SRFI-64. ;;; @@ -31,7 +9,7 @@ (test-group "default keys" (for-each (lambda (key value) (let ((name (symbol->string key))) - (test-assert (string-append "contains " name) + (test-body (string-append "contains " name) (test-contains? key)) (test-eq name value (test-ref key)))) '(setup-test! after-test before-test! report-test @@ -51,12 +29,12 @@ (let ((pair (cons #f #f))) (test-set! 'nonexistent-key pair) (test-eq "set unused key" pair (test-ref 'nonexistent-key)) - (parameterize ((test-info '(box))) + (parameterize ((test-info (test-info-dict))) (test-eq "persistent across parameterization" pair (test-ref 'nonexistent-key)) (let ((pair2 (cons #f #f))) - (test-assert "made a new pair" + (test-body "made a new pair" (not (eq? pair pair2))) (test-set! 'nonexistent-key pair2) (test-eq "set key to a new pair" @@ -65,15 +43,14 @@ (test-eq "outside of parameterization" pair (test-ref 'nonexistent-key))) - (parameterize ((test-info (list 'replace - (test-set 'other-key 123)))) + (parameterize ((test-info (test-set 'other-key 123))) (test-eqv "other key in parameterization" 123 (test-ref 'other-key))) (test-eqv "does not affect outside" 456 (test-ref/default 'other-key 456)) - (test-assert "deleted key" + (test-body "deleted key" (test-delete! 'nonexistent-key) (not (test-contains? 'nonexistent-keys)))) @@ -85,46 +62,42 @@ ;;; `on-exception` handler. Hence exceptions inside of a `call-as-test` ;;; will trip the actual exception handler for the meta test-info. -(define-values (dummy-dto dummy-dict) - (inspect-test-info - (lambda (dto dict) - (define dummy (lambda _ #f)) - (values dto - (dict-set! dto - dict - 'skip-test? dummy - 'before-test! dummy - 'setup-test! dummy - 'when-test-skipped dummy - 'after-test values - 'report-test dummy - 'on-exception dummy - 'setup-group! dummy - 'before-group! dummy - 'after-group values - 'report-group dummy))))) +(define dummy-dict + (let ((dummy (lambda _ #f))) + (dict-set! (test-dto) + default-test-info-dict + 'skip-test? dummy + 'before-test! dummy + 'setup-test! dummy + 'when-test-skipped dummy + 'after-test values + 'report-test dummy + 'on-exception dummy + 'setup-group! dummy + 'before-group! dummy + 'after-group values + 'report-group dummy))) (test-group "call-as-test, dummy dict" (test-group "before test" - (test-assert "skip-test? skips tests when returning #f" + (test-body "skip-test? skips tests when returning #f" (parameterize ((test-info - (list 'replace - (dict-set! dummy-dto dummy-dict - 'skip-test? - (lambda (name) #t))))) + (dict-set! (test-dto) + dummy-dict + 'skip-test? + (lambda (name) #t)))) (let ((called? #f)) (call-as-test "name" (lambda () (set! called? #t))) (not called?)))) - (test-assert "before-test gets the test name" - (define inside-test-info - (dict-set! dummy-dto dummy-dict - 'before-test! - (lambda (name) - (unless (equal? name "1234") - (raise "exception")) - #t))) + (test-body "before-test gets the test name" (parameterize ((test-info - (list 'replace inside-test-info))) + (dict-set! (test-dto) + dummy-dict + 'before-test! + (lambda (name) + (unless (equal? name "1234") + (raise "exception")) + #t)))) (let ((called? #f)) (call-as-test "1234" (lambda () (set! called? #t))) @@ -132,76 +105,70 @@ (test-group "after test" (let ((called? #f) (pair (cons #f #f))) - (define inside-test-info - (dict-set! dummy-dto dummy-dict - 'after-test - (lambda (previous-dto previous-dict) - (set! called? - (dict-ref previous-dto previous-dict - 'after-test-test))))) - (test-assert "after test is called with previous test-info" + (define inside-test-info) + (test-body "after test is called with previous test-info" (parameterize ((test-info - (list 'replace dummy-dto inside-test-info))) + (dict-set! (test-dto) dummy-dict + 'after-test + (lambda (previous-dict) + (set! called? + (dict-ref (test-dto) + previous-dict + 'after-test-test)))))) (call-as-test #f (lambda () (test-set! 'after-test-test #t)))) called?)) - (let* ((pair (cons #f #f)) - (inside-test-info - (dict-set! dummy-dto dummy-dict - 'after-test - (lambda _ pair)))) + (let* ((pair (cons #f #f))) (test-eq "return value of call-as-test is after-test" pair (parameterize ((test-info - (list 'replace - dummy-dto inside-test-info))) + (dict-set! (test-dto) dummy-dict + 'after-test + (lambda _ pair)))) (call-as-test #f (lambda () #f)))))) - (test-assert "setup-test runs in dynamic extent" + (test-body "setup-test runs in dynamic extent" (let ((global-name "setup-test-name") (called? #f) (pair (cons #f #f))) - (define inside-test-info - (dict-set! dummy-dto dummy-dict - 'setup-test! - (lambda (name) - (test-set! 'setup-test-test pair)))) - (parameterize ((test-info (list 'replace dummy-dto inside-test-info))) + (parameterize ((test-info + (dict-set! (test-dto) + dummy-dict + 'setup-test! + (lambda (name) + (test-set! 'setup-test-test pair))))) (call-as-test global-name (lambda () (set! called? (eq? (test-ref 'setup-test-test) pair))))) (and called? (not (test-contains? 'setup-test-test))))) (test-group "on-exception" - (test-assert "not called" + (test-body "not called" (call/cc (lambda (return) (define inside-test-info - (dict-set! dummy-dto dummy-dict + (dict-set! (test-dto) + dummy-dict 'exception-not-called? #t 'on-exception (lambda (exn return) (test-set! 'exception-not-called? #f)) 'after-test - (lambda (previous-dto previous-dict) - (return (dict-ref previous-dto previous-dict + (lambda (previous-dict) + (return (dict-ref (test-dto) + previous-dict 'exception-not-called?))))) - (parameterize ((test-info (list 'replace dummy-dto - inside-test-info))) + (parameterize ((test-info inside-test-info)) (call-as-test #f (lambda () #f))) #f))) (let* ((message "exception message") - (caught #f) - (inside-test-info - (dict-set! dummy-dto dummy-dict - 'on-exception - (lambda (exn return) - (set! caught exn) - (return))))) - (test-assert "called" - (parameterize ((test-info - (list 'replace dummy-dto - inside-test-info))) + (caught #f)) + (test-body "called" + (parameterize ((test-info (dict-set! (test-dto) dummy-dict + 'on-exception + (lambda (exn return) + (set! caught exn) + (return))))) (call-as-test #f (lambda () (raise message))) caught))))) @@ -219,7 +186,7 @@ ;;; `(inspect-test-info values)` inside the dynamic extent. (define silent-dict - (dict-set! default-test-info-dto default-test-info-dict + (dict-set! default-test-dto default-test-info-dict 'before-test! values 'before-group! values 'report-test values @@ -227,223 +194,208 @@ (test-group "call-as-test, some defaults" (test-group "no name" - (define-values (dto dict outer-dto outer-dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) - (let*-values (((inner-dto inner-dict) - (call-as-test #f (lambda () #f))) - ((outer-dto outer-dict) - (inspect-test-info values))) - (values inner-dto inner-dict outer-dto outer-dict)))) - (test-eqv "name is #f" #f (dict-ref dto dict 'name)) - (test-eqv "name-stack" '() (dict-ref dto dict 'name-stack)) - (test-eqv "outer name is #f" #f (dict-ref outer-dto outer-dict 'name)) - (test-eqv "outer name-stack" '() (dict-ref outer-dto outer-dict 'name-stack))) + (define-values (dict outer-dict) + (parameterize ((test-info silent-dict)) + (let ((inner-dict (call-as-test #f (lambda () #f)))) + (values inner-dict (test-info-dict))))) + (test-eqv "name is #f" #f (dict-ref (test-dto) dict 'name)) + (test-eqv "name-stack" '() (dict-ref (test-dto) dict 'name-stack)) + (test-eqv "outer name is #f" #f (dict-ref (test-dto) outer-dict 'name)) + (test-eqv "outer name-stack" '() (dict-ref (test-dto) outer-dict 'name-stack))) (test-group "named" - (define-values (dto dict outer-dto outer-dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) - (let*-values (((inner-dto inner-dict) - (call-as-test "asdfasdf" (lambda () #f))) - ((outer-dto outer-dict) - (inspect-test-info values))) - (values inner-dto inner-dict outer-dto outer-dict)))) - (test-equal "name is #f" "asdfasdf" (dict-ref dto dict 'name)) - (test-equal "name-stack" '("asdfasdf") (dict-ref dto dict 'name-stack)) - (test-eqv "outer name is #f" #f (dict-ref outer-dto outer-dict 'name)) - (test-eqv "outer name-stack" '() (dict-ref outer-dto outer-dict 'name-stack))) + (define-values (dict outer-dict) + (parameterize ((test-info silent-dict)) + (let ((inner-dict (call-as-test "asdfasdf" (lambda () #f)))) + (values inner-dict (test-info-dict))))) + (test-equal "name is #f" "asdfasdf" (dict-ref (test-dto) dict 'name)) + (test-equal "name-stack" '("asdfasdf") (dict-ref (test-dto) dict 'name-stack)) + (test-eqv "outer name is #f" #f (dict-ref (test-dto) outer-dict 'name)) + (test-eqv "outer name-stack" '() (dict-ref (test-dto) outer-dict 'name-stack))) (test-group "tests that success is true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (call-as-test #f (lambda () (test-set! 'success? #t))) - (inspect-test-info values))) - (test-eqv "passed number" 1 (dict-ref dto dict 'passed)) - (test-eqv "failed number" 0 (dict-ref dto dict 'failed)) - (test-eqv "test number" 1 (dict-ref dto dict 'tests))) + (test-info-dict))) + (test-eqv "passed number" 1 (dict-ref (test-dto) dict 'passed)) + (test-eqv "failed number" 0 (dict-ref (test-dto) dict 'failed)) + (test-eqv "test number" 1 (dict-ref (test-dto) dict 'tests))) (test-group "test that success is false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (call-as-test #f (lambda () (test-set! 'success? #f))) - (inspect-test-info values))) - (test-eqv "passed number" 0 (dict-ref dto dict 'passed)) - (test-eqv "failed number" 1 (dict-ref dto dict 'failed)) - (test-eqv "test number" 1 (dict-ref dto dict 'tests))) + (test-info-dict))) + (test-eqv "passed number" 0 (dict-ref (test-dto) dict 'passed)) + (test-eqv "failed number" 1 (dict-ref (test-dto) dict 'failed)) + (test-eqv "test number" 1 (dict-ref (test-dto) dict 'tests))) (test-group "success not set" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (call-as-test #f (lambda () #f)) - (inspect-test-info values))) - (test-eqv "passed number" 0 (dict-ref dto dict 'passed)) - (test-eqv "failed number" 1 (dict-ref dto dict 'failed)) - (test-eqv "test number" 1 (dict-ref dto dict 'tests))) + (test-info-dict))) + (test-eqv "passed number" 0 (dict-ref (test-dto) dict 'passed)) + (test-eqv "failed number" 1 (dict-ref (test-dto) dict 'failed)) + (test-eqv "test number" 1 (dict-ref (test-dto) dict 'tests))) (test-group "catching exceptions" (define pair (cons #f #f)) - (define-values (inner-dto inner-dict outer-dto outer-dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) - (let*-values (((inner-dto inner-dict) (call-as-test #f (lambda () (raise pair)))) - ((outer-dto outer-dict) (inspect-test-info values))) - (values inner-dto inner-dict outer-dto outer-dict)))) - (test-eqv "exception" pair (dict-ref inner-dto inner-dict 'exception)) - (test-eqv "passed number" 0 (dict-ref outer-dto outer-dict 'passed)) - (test-eqv "failed number" 1 (dict-ref outer-dto outer-dict 'failed)) - (test-eqv "test number" 1 (dict-ref outer-dto outer-dict 'tests)))) + (define-values (inner-dict outer-dict) + (parameterize ((test-info silent-dict)) + (let ((inner-dict (call-as-test #f (lambda () (raise pair))))) + (values inner-dict (test-info-dict))))) + (test-eqv "exception" pair (dict-ref (test-dto) inner-dict 'exception)) + (test-eqv "passed number" 0 (dict-ref (test-dto) outer-dict 'passed)) + (test-eqv "failed number" 1 (dict-ref (test-dto) outer-dict 'failed)) + (test-eqv "test number" 1 (dict-ref (test-dto) outer-dict 'tests)))) (test-group "call-as-group" (test-group "group with no tests" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (call-as-group #f (lambda () #f)) - (inspect-test-info values))) - (test-eqv "passed number" 0 (dict-ref dto dict 'passed)) - (test-eqv "tests number" 0 (dict-ref dto dict 'tests)) - (test-eqv "failed number" 0 (dict-ref dto dict 'failed)) - (test-eqv "skipped number" 0 (dict-ref dto dict 'skipped))) + (test-info-dict))) + (test-eqv "passed number" 0 (dict-ref (test-dto) dict 'passed)) + (test-eqv "tests number" 0 (dict-ref (test-dto) dict 'tests)) + (test-eqv "failed number" 0 (dict-ref (test-dto) dict 'failed)) + (test-eqv "skipped number" 0 (dict-ref (test-dto) dict 'skipped))) (test-group "group with 1 test" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) - (test-group #f (test-assert #f #t)) - (inspect-test-info values))) - (test-eqv "passed number" 1 (dict-ref dto dict 'passed)) - (test-eqv "tests number" 1 (dict-ref dto dict 'tests)) - (test-eqv "failed number" 0 (dict-ref dto dict 'failed)) - (test-eqv "skipped number" 0 (dict-ref dto dict 'skipped))) + (define dict + (parameterize ((test-info silent-dict)) + (test-group #f (test-body #f #t)) + (test-info-dict))) + (test-eqv "passed number" 1 (dict-ref (test-dto) dict 'passed)) + (test-eqv "tests number" 1 (dict-ref (test-dto) dict 'tests)) + (test-eqv "failed number" 0 (dict-ref (test-dto) dict 'failed)) + (test-eqv "skipped number" 0 (dict-ref (test-dto) dict 'skipped))) (test-group "group with multiple tests" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (test-group #f - (call-as-test #f (lambda () - (test-set! 'success? #t))) - (call-as-test #f (lambda () - (test-set! 'success? #t))) - (call-as-test #f (lambda () - (test-set! 'success? #f))) + (call-as-test #f (lambda () (test-set! 'success? #t))) + (call-as-test #f (lambda () (test-set! 'success? #t))) + (call-as-test #f (lambda () (test-set! 'success? #f))) (test-skip-all - (call-as-test #f (lambda () - (test-set! 'success? #f))))) - (inspect-test-info values))) + (call-as-test #f (lambda () (test-set! 'success? #f))))) + (test-info-dict))) (begin - (test-eqv "passed number" 2 (dict-ref dto dict 'passed)) - (test-eqv "tests number" 4 (dict-ref dto dict 'tests)) - (test-eqv "failed number" 1 (dict-ref dto dict 'failed)) - (test-eqv "skipped number" 1 (dict-ref dto dict 'skipped)))) + (test-eqv "passed number" 2 (dict-ref (test-dto) dict 'passed)) + (test-eqv "tests number" 4 (dict-ref (test-dto) dict 'tests)) + (test-eqv "failed number" 1 (dict-ref (test-dto) dict 'failed)) + (test-eqv "skipped number" 1 (dict-ref (test-dto) dict 'skipped)))) (test-group "nested groups" (define inner-dict #f) - (define inner-dto #f) - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (define dict + (parameterize ((test-info silent-dict)) (test-group "gr1" - (test-assert #f #t) + (test-body #f #t) (test-group "gr2" - (test-assert #f - (inspect-test-info - (lambda (dto dict) - (set! inner-dto dto) - (set! inner-dict dict))) + (test-body #f + (set! inner-dict (test-info-dict)) #f))) (inspect-test-info values))) - (test-eqv "passed number" 1 (dict-ref dto dict 'passed)) - (test-eqv "tests number" 2 (dict-ref dto dict 'tests)) - (test-eqv "failed number" 1 (dict-ref dto dict 'failed)) - (test-eqv "skipped number" 0 (dict-ref dto dict 'skipped)) - (test-eqv "inner name" #f (dict-ref inner-dto inner-dict 'name)) + (test-eqv "passed number" 1 (dict-ref (test-dto) dict 'passed)) + (test-eqv "tests number" 2 (dict-ref (test-dto) dict 'tests)) + (test-eqv "failed number" 1 (dict-ref (test-dto) dict 'failed)) + (test-eqv "skipped number" 0 (dict-ref (test-dto) dict 'skipped)) + (test-eqv "inner name" #f (dict-ref (test-dto) inner-dict 'name)) (test-equal "inner name stack" '("gr2" "gr1") - (dict-ref inner-dto inner-dict 'name-stack)))) + (dict-ref (test-dto) inner-dict 'name-stack)))) (test-group "test application" - (test-assert "true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "true" + (define dict + (parameterize ((test-info silent-dict)) (test-application "not" (not not) (arg #f)) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "false" + (define dict + (parameterize ((test-info silent-dict)) (test-application "not" (not not) (arg #t)) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "test-equal" - (test-assert "true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "true" + (define dict + (parameterize ((test-info silent-dict)) (test-equal "equal" "abc" "abc") - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "false" + (define dict + (parameterize ((test-info silent-dict)) (test-equal "equal" "abc" "def") - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "test-eq" - (test-assert "true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "true" + (define dict + (parameterize ((test-info silent-dict)) (test-eq "eq" 'abc 'abc) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "false" + (define dict + (parameterize ((test-info silent-dict)) (test-eq "eq" 'abc 'def) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "test-eqv" - (test-assert "true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "true" + (define dict + (parameterize ((test-info silent-dict)) (test-eqv "eqv" 100 100) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "false" + (define dict + (parameterize ((test-info silent-dict)) (test-eqv "eqv" 100 200) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "test-approximate" - (test-assert "true" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "true" + (define dict + (parameterize ((test-info silent-dict)) (test-approximate "approx" 1 1.001 0.01) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "false" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "false" + (define dict + (parameterize ((test-info silent-dict)) (test-approximate "approx" 100 1.01 0.01) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "test-error" - (test-assert "thrown exception" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-body "thrown exception" + (define dict + (parameterize ((test-info silent-dict)) (test-error #f (lambda (ex) (equal? ex "exception")) (raise "exception")) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'passed))) - (test-assert "no thrown exception" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'passed))) + (test-body "no thrown exception" + (define dict + (parameterize ((test-info silent-dict)) (test-error #f (lambda (ex) #t) #f) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed))) - (test-assert "incorrectly thrown exception" - (define-values (dto dict) - (parameterize ((test-info (list 'replace default-test-info-dto silent-dict))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed))) + (test-body "incorrectly thrown exception" + (define dict + (parameterize ((test-info silent-dict)) (test-error #f number? (raise "exception")) - (inspect-test-info values))) - (eqv? 1 (dict-ref dto dict 'failed)))) + (test-info-dict))) + (eqv? 1 (dict-ref (test-dto) dict 'failed)))) (test-group "expect-to-fail" (expect-to-fail - (test-assert "1 = 2" (eqv? 1 2)) - (test-assert "type error" (car '())))) + (test-body "1 = 2" (eqv? 1 2)) + (test-body "type error" (car '())))) (test-exit) diff --git a/tests/run.scm b/tests/run.scm index 474672c..e70e8af 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -1,30 +1,8 @@ -#| Copyright © 2025 Peter McGoron - | - | Permission is hereby granted, free of charge, to any person obtaining - | a copy of this software and associated documentation files (the - | “Software”), to deal in the Software without restriction, including - | without limitation the rights to use, copy, modify, merge, publish, - | distribute, sublicense, and/or sell copies of the Software, and to - | permit persons to whom the Software is furnished to do so, subject to - | the following conditions: - | - | The above copyright notice and this permission notice shall be included - | in all copies or substantial portions of the Software. - | - | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, - | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - | THE USE OR OTHER DEALINGS IN THE SOFTWARE. - |# - (cond-expand (chicken-5 (import r7rs)) - (else #f)) + (else)) -(import (conspire) (srfi 225) (scheme load)) +(import (cuprate) (srfi 225)) + (include "impl.scm") -(include "impl.scm") |
