Skip to content

Commit 893544e

Browse files
raviqqeCopilot
andauthored
Refactor command tests (#3279)
Signed-off-by: Yota Toyama <raviqqe@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 45911c2 commit 893544e

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

features/instrinsics.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Feature: Intrinsics
1515
Scenario: Preserve a tag when a `cdr` is set
1616
Given a file named "main.scm" with:
1717
"""scheme
18-
(import (scheme base) (scheme write))
18+
(import (scheme base))
1919
2020
(define x (rib 0 #f #f 7))
2121

features/macro.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Feature: Macro
267267
Scenario: Expand an empty ellipsis pattern and an improper list
268268
Given a file named "main.scm" with:
269269
"""scheme
270-
(import (scheme base) (scheme write))
270+
(import (scheme base))
271271
272272
(define-syntax foo
273273
(syntax-rules ()

features/niche.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Feature: Niche functionalities
1111
Scenario: Dump a stack trace on an error
1212
Given a file named "main.scm" with:
1313
"""scheme
14-
(import (scheme base) (scheme write) (stak backtrace))
14+
(import (scheme base) (stak backtrace))
1515
1616
(define (foo)
1717
(error "foo")

features/optimization.feature

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,44 @@ Feature: Optimization
44
Scenario: Match a rule
55
Given a file named "main.scm" with:
66
"""scheme
7-
(import (scheme base) (scheme write) (stak base))
7+
(import (scheme base) (stak base))
88
99
(define-optimizer foo
1010
(syntax-rules ()
1111
((foo)
12-
(write 42))))
12+
(write-u8 65))))
1313
1414
(foo)
1515
"""
1616
When I successfully run `stak main.scm`
17-
Then the stdout should contain exactly "42"
17+
Then the stdout should contain exactly "A"
1818

1919
Scenario: Match a variable pattern
2020
Given a file named "main.scm" with:
2121
"""scheme
22-
(import (scheme base) (scheme write) (stak base))
22+
(import (scheme base) (stak base))
2323
2424
(define-optimizer foo
2525
(syntax-rules ()
2626
((foo x)
27-
(write x))))
27+
(write-u8 x))))
2828
29-
(foo 42)
29+
(foo 65)
3030
"""
3131
When I successfully run `stak main.scm`
32-
Then the stdout should contain exactly "42"
32+
Then the stdout should contain exactly "A"
3333

3434
Scenario: Match an ellipsis pattern
3535
Given a file named "main.scm" with:
3636
"""scheme
37-
(import (scheme base) (scheme write) (stak base))
37+
(import (scheme base) (stak base))
3838
3939
(define-optimizer foo
4040
(syntax-rules ()
4141
((foo x ...)
42-
(write (list x ...)))))
42+
(for-each write-u8 (list x ...)))))
4343
44-
(foo 1 2 3)
44+
(foo 65 66 67)
4545
"""
4646
When I successfully run `stak main.scm`
47-
Then the stdout should contain exactly "(1 2 3)"
47+
Then the stdout should contain exactly "ABC"

features/smoke.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Feature: Smoke
3131
Scenario: Compile symbols in an if expression in a procedure
3232
Given a file named "main.scm" with:
3333
"""scheme
34-
(import (scheme base) (scheme write))
34+
(import (scheme base))
3535
3636
(define (foo)
3737
(if #f 'foo 'bar))
@@ -45,7 +45,7 @@ Feature: Smoke
4545
Scenario: Compile many sequential `if` expressions
4646
Given a file named "main.scm" with:
4747
"""scheme
48-
(import (scheme base) (scheme write))
48+
(import (scheme base))
4949
"""
5050
And a file named "foo.scm" with:
5151
"""scheme

features/syntaxes/cond-expand.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ Feature: cond-expand
100100
Scenario: Examine features
101101
Given a file named "main.scm" with:
102102
"""scheme
103-
(import (scheme base) (scheme write))
103+
(import (scheme base))
104104
105-
(write (features))
105+
(write-u8 (if (memq 'r7rs (features)) 65 66))
106106
"""
107107
When I successfully run `stak main.scm`
108-
Then the stdout should contain "r7rs"
108+
Then the stdout should contain exactly "A"
109109

110110
Rule: `and`
111111

features/types/bytevector.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ Feature: Bytevector
149149
Scenario Outline: Reference an element
150150
Given a file named "main.scm" with:
151151
"""scheme
152-
(import (scheme base) (scheme write))
152+
(import (scheme base))
153153
154-
(write (bytevector-u8-ref (make-bytevector <length> 42) <index>))
154+
(write-u8 (bytevector-u8-ref (make-bytevector <length> 65) <index>))
155155
"""
156156
When I successfully run `stak main.scm`
157-
Then the stdout should contain exactly "42"
157+
Then the stdout should contain exactly "A"
158158

159159
Examples:
160160
| length | index |
@@ -183,11 +183,11 @@ Feature: Bytevector
183183
Scenario Outline: Use a bytevector literal
184184
Given a file named "main.scm" with:
185185
"""scheme
186-
(import (scheme base) (scheme write))
186+
(import (scheme base))
187187
188188
(define xs (include "./value.scm"))
189189
190-
(write (bytevector-u8-ref xs <index>))
190+
(write-u8 (if (= (bytevector-u8-ref xs <index>) <index>) 65 66))
191191
"""
192192
And a file named "write.scm" with:
193193
"""scheme
@@ -205,7 +205,7 @@ Feature: Bytevector
205205
stak write.scm > value.scm
206206
"""
207207
When I successfully run `stak main.scm`
208-
Then the stdout should contain exactly "<index>"
208+
Then the stdout should contain exactly "A"
209209

210210
Examples:
211211
| length | index |

features/types/vector.feature

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ Feature: Vector
227227
Scenario Outline: Reference an element
228228
Given a file named "main.scm" with:
229229
"""scheme
230-
(import (scheme base) (scheme write))
230+
(import (scheme base))
231231
232-
(write (vector-ref (make-vector <length> 42) <index>))
232+
(write-u8 (vector-ref (make-vector <length> 65) <index>))
233233
"""
234234
When I successfully run `stak main.scm`
235-
Then the stdout should contain exactly "42"
235+
Then the stdout should contain exactly "A"
236236

237237
Examples:
238238
| length | index |
@@ -260,14 +260,14 @@ Feature: Vector
260260
Scenario Outline: Convert values between a list and a vector
261261
Given a file named "main.scm" with:
262262
"""scheme
263-
(import (scheme base) (scheme write) (srfi 1))
263+
(import (scheme base) (srfi 1))
264264
265265
(define xs (iota <count>))
266266
267-
(write (equal? (vector->list (list->vector xs)) xs))
267+
(write-u8 (if (equal? (vector->list (list->vector xs)) xs) 65 66))
268268
"""
269269
When I successfully run `stak main.scm`
270-
Then the stdout should contain exactly "#t"
270+
Then the stdout should contain exactly "A"
271271

272272
Examples:
273273
| count |
@@ -298,11 +298,11 @@ Feature: Vector
298298
Scenario Outline: Use a vector literal
299299
Given a file named "main.scm" with:
300300
"""scheme
301-
(import (scheme base) (scheme write))
301+
(import (scheme base))
302302
303303
(define xs (include "./value.scm"))
304304
305-
(write (vector-ref xs <index>))
305+
(write-u8 (if (= (vector-ref xs <index>) <index>) 65 66))
306306
"""
307307
And a file named "write.scm" with:
308308
"""scheme
@@ -315,7 +315,7 @@ Feature: Vector
315315
stak write.scm > value.scm
316316
"""
317317
When I successfully run `stak main.scm`
318-
Then the stdout should contain exactly "<index>"
318+
Then the stdout should contain exactly "A"
319319

320320
Examples:
321321
| length | index |

0 commit comments

Comments
 (0)