aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-09-21 09:15:38 -0400
committerGravatar Peter McGoron 2025-09-21 09:15:38 -0400
commitf8385d7a7c7975abb474f06bf2fbc44e264f571c (patch)
tree2327abfa78fb0f38f3180742663daff4b99e646e
parentadd pretty-printer (diff)
replace with-test-assert with test-assert for better compat with SRFI-64
-rw-r--r--lib/conspire.scm2
-rw-r--r--lib/conspire.sld2
-rw-r--r--tests/impl.scm52
3 files changed, 28 insertions, 28 deletions
diff --git a/lib/conspire.scm b/lib/conspire.scm
index d830edd..b02c9ce 100644
--- a/lib/conspire.scm
+++ b/lib/conspire.scm
@@ -332,7 +332,7 @@
(test-set! 'application (list name ...))
(test-set! 'success? (name ...))))))))
-(define-syntax with-test-assert
+(define-syntax test-assert
(syntax-rules ()
((_ name body ...)
(call-as-test name (lambda ()
diff --git a/lib/conspire.sld b/lib/conspire.sld
index 4bd9bdc..430a2a7 100644
--- a/lib/conspire.sld
+++ b/lib/conspire.sld
@@ -39,7 +39,7 @@
default-after-group default-report-group
default-test-info-dict default-test-info-dto
;; SRFI-64 style assertions
- test-application with-test-assert
+ test-application test-assert
test-equal test-eqv test-eq test-approximate
call-as-test-error with-test-error
test-skip-all
diff --git a/tests/impl.scm b/tests/impl.scm
index 3a3e822..6783dd9 100644
--- a/tests/impl.scm
+++ b/tests/impl.scm
@@ -31,8 +31,8 @@
(test-group "default keys"
(for-each (lambda (key value)
(let ((name (symbol->string key)))
- (with-test-assert (string-append "contains " name)
- (test-contains? key))
+ (test-assert (string-append "contains " name)
+ (test-contains? key))
(test-eq name value (test-ref key))))
'(setup-test! after-test before-test! report-test
skip-test? when-test-skipped
@@ -56,7 +56,7 @@
pair
(test-ref 'nonexistent-key))
(let ((pair2 (cons #f #f)))
- (with-test-assert "made a new pair"
+ (test-assert "made a new pair"
(not (eq? pair pair2)))
(test-set! 'nonexistent-key pair2)
(test-eq "set key to a new pair"
@@ -73,7 +73,7 @@
(test-eqv "does not affect outside"
456
(test-ref/default 'other-key 456))
- (with-test-assert "deleted key"
+ (test-assert "deleted key"
(test-delete! 'nonexistent-key)
(not (test-contains? 'nonexistent-keys))))
@@ -106,7 +106,7 @@
(test-group "call-as-test, dummy dict"
(test-group "before test"
- (with-test-assert "skip-test? skips tests when returning #f"
+ (test-assert "skip-test? skips tests when returning #f"
(parameterize ((test-info
(list 'replace
(dict-set! dummy-dto dummy-dict
@@ -115,7 +115,7 @@
(let ((called? #f))
(call-as-test "name" (lambda () (set! called? #t)))
(not called?))))
- (with-test-assert "before-test gets the test name"
+ (test-assert "before-test gets the test name"
(define inside-test-info
(dict-set! dummy-dto dummy-dict
'before-test!
@@ -139,7 +139,7 @@
(set! called?
(dict-ref previous-dto previous-dict
'after-test-test)))))
- (with-test-assert "after test is called with previous test-info"
+ (test-assert "after test is called with previous test-info"
(parameterize ((test-info
(list 'replace dummy-dto inside-test-info)))
(call-as-test #f
@@ -157,7 +157,7 @@
(list 'replace
dummy-dto inside-test-info)))
(call-as-test #f (lambda () #f))))))
- (with-test-assert "setup-test runs in dynamic extent"
+ (test-assert "setup-test runs in dynamic extent"
(let ((global-name "setup-test-name")
(called? #f)
(pair (cons #f #f)))
@@ -172,7 +172,7 @@
(set! called? (eq? (test-ref 'setup-test-test) pair)))))
(and called? (not (test-contains? 'setup-test-test)))))
(test-group "on-exception"
- (with-test-assert "not called"
+ (test-assert "not called"
(call/cc
(lambda (return)
(define inside-test-info
@@ -198,7 +198,7 @@
(lambda (exn return)
(set! caught exn)
(return)))))
- (with-test-assert "called"
+ (test-assert "called"
(parameterize ((test-info
(list 'replace dummy-dto
inside-test-info)))
@@ -299,7 +299,7 @@
(test-group "group with 1 test"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
- (test-group #f (with-test-assert #f #t))
+ (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))
@@ -330,9 +330,9 @@
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-group "gr1"
- (with-test-assert #f #t)
+ (test-assert #f #t)
(test-group "gr2"
- (with-test-assert #f
+ (test-assert #f
(inspect-test-info
(lambda (dto dict)
(set! inner-dto dto)
@@ -348,13 +348,13 @@
(dict-ref inner-dto inner-dict 'name-stack))))
(test-group "test application"
- (with-test-assert "true"
+ (test-assert "true"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-application "not" (not not) (arg #f))
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "false"
+ (test-assert "false"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-application "not" (not not) (arg #t))
@@ -362,13 +362,13 @@
(eqv? 1 (dict-ref dto dict 'failed))))
(test-group "test-equal"
- (with-test-assert "true"
+ (test-assert "true"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-equal "equal" "abc" "abc")
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "false"
+ (test-assert "false"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-equal "equal" "abc" "def")
@@ -376,13 +376,13 @@
(eqv? 1 (dict-ref dto dict 'failed))))
(test-group "test-eq"
- (with-test-assert "true"
+ (test-assert "true"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-eq "eq" 'abc 'abc)
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "false"
+ (test-assert "false"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-eq "eq" 'abc 'def)
@@ -390,13 +390,13 @@
(eqv? 1 (dict-ref dto dict 'failed))))
(test-group "test-eqv"
- (with-test-assert "true"
+ (test-assert "true"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-eqv "eqv" 100 100)
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "false"
+ (test-assert "false"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-eqv "eqv" 100 200)
@@ -404,13 +404,13 @@
(eqv? 1 (dict-ref dto dict 'failed))))
(test-group "test-approximate"
- (with-test-assert "true"
+ (test-assert "true"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-approximate "approx" 1 1.001 0.01)
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "false"
+ (test-assert "false"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(test-approximate "approx" 100 1.01 0.01)
@@ -418,7 +418,7 @@
(eqv? 1 (dict-ref dto dict 'failed))))
(test-group "test-error"
- (with-test-assert "thrown exception"
+ (test-assert "thrown exception"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(with-test-error #f
@@ -426,7 +426,7 @@
(raise "exception"))
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'passed)))
- (with-test-assert "no thrown exception"
+ (test-assert "no thrown exception"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(with-test-error #f
@@ -434,7 +434,7 @@
#f)
(inspect-test-info values)))
(eqv? 1 (dict-ref dto dict 'failed)))
- (with-test-assert "incorrectly thrown exception"
+ (test-assert "incorrectly thrown exception"
(define-values (dto dict)
(parameterize ((test-info (list 'replace default-test-info-dto silent-dict)))
(with-test-error #f number? (raise "exception"))