Skip to content

Commit 9594670

Browse files
committed
Implements proper semantic for test and capability. test does not require explicit lambda anymore, capability creates a scope by wrapping the list in a lambda
1 parent 89c10dd commit 9594670

File tree

6 files changed

+361
-355
lines changed

6 files changed

+361
-355
lines changed

rosetta-test-suites/fs.ros

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
(remove-test-file "my-test-file")))
2424

2525
(capability 'open (list
26-
(test "open returns a file descriptor" (lambda ()
27-
(assert (is-file-descriptor? (open "my-test-file" "r")))))
26+
(test "open returns a file descriptor"
27+
(assert (is-file-descriptor? (open "my-test-file" "r"))))
2828

29-
(test "opening with non-existant mode, results in error" (lambda () (begin
29+
(test "opening with non-existant mode, results in error"
3030
(assert (is-file-error? (open "my-test-file" "g")))
3131
(assert (is-file-error? (open "my-test-file" "rq")))
32-
(assert (is-file-error? (open "my-test-file" "qr"))))))))
32+
(assert (is-file-error? (open "my-test-file" "qr"))))))
3333

3434
(capability 'close (list
3535
(setup (lambda ()
@@ -39,13 +39,13 @@
3939
(close test-file)
4040
(set! test-file '()))))
4141

42-
(test "a closed file descriptor does not allow further reads" (lambda ()
42+
(test "a closed file descriptor does not allow further reads"
4343
(close test-file)
44-
(assert (is-file-error? (read test-file 1)))))
44+
(assert (is-file-error? (read test-file 1))))
4545

46-
(test "a closed file descriptor does not allow further writes" (lambda ()
46+
(test "a closed file descriptor does not allow further writes"
4747
(close test-file)
48-
(assert (is-file-error? (write test-file "abc")))))))
48+
(assert (is-file-error? (write test-file "abc"))))))
4949

5050
(capability 'read (list
5151
(setup (lambda ()
@@ -55,18 +55,18 @@
5555
(close test-file)
5656
(set! test-file '()))))
5757

58-
(test "read can read one value" (lambda ()
58+
(test "read can read one value"
5959
(assert-equal
6060
(read test-file 1)
61-
"f")))
61+
"f"))
6262

63-
(test "read can read all of the content" (lambda ()
63+
(test "read can read all of the content"
6464
(assert-equal
6565
(read test-file 23)
66-
"first line\nsecond line")))
66+
"first line\nsecond line"))
6767

68-
(test "read on a write-only file is an error" (lambda () (begin
68+
(test "read on a write-only file is an error" (begin
6969
(close test-file) ; to ensure we can open it write-only
7070
(let
7171
((write-only-file (open "my-test-file" "w")))
72-
(assert (is-file-error? (read write-only-file 1)))))))))))
72+
(assert (is-file-error? (read write-only-file 1))))))))))

rosetta-test-suites/json-rfc.ros

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(filter (lambda (test-file-name) (string-prefix? prefix test-file-name)) all-test-file-names)))
1717
(map
1818
(lambda (test-file-name)
19-
(test (string-replace ".json" "" test-file-name) (lambda ()
19+
(make-test (string-replace ".json" "" test-file-name) (lambda ()
2020
(let ((result (parse (file-contents test-file-name))))
2121
(cond
2222
((string-prefix? "y" test-file-name)

0 commit comments

Comments
 (0)