Skip to content

Write

Given a file named “main.scm” with:

(import (scheme base))
(write-u8 65)

When I successfully run stak main.scm

Then the stdout should contain exactly “A”.

Given a file named “main.scm” with:

(import (scheme base))
(write-char #\<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
a
A
~

Given a file named “main.scm” with:

(import (scheme base))
(write-char #\<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
д
😄

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

valueoutput
#\a#\a
#\A#\A
#(#\(
###\#

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

valueoutput
#\alarm#\alarm
#\backspace#\backspace
#\delete#\delete
#\escape#\escape
#\newline#\newline
#\null#\null
#\return#\return
#\space#\space
#\tab#\tab

Given a file named “main.scm” with:

(import (scheme base))
(write-string "Hello, world!")

When I successfully run stak main.scm

Then the stdout should contain exactly “Hello, world!”.

Given a file named “main.scm” with:

(import (scheme base))
(write-string "<value>")

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
\n
\t

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
#f
#t

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write '<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
()
(1)
(1 2)
(1 2 3)
(1 (1 2) (3 4 5))
(1 . 2)
(1 2 . 3)

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
0
1
42
-1
-42

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write (lambda () #f))

When I successfully run stak main.scm

Then the stdout should contain exactly “#procedure”.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define-record-type foo
(make-foo)
foo?)
(write (make-foo))

When I successfully run stak main.scm

Then the stdout should contain exactly “#record”.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write "<value>")

When I successfully run stak main.scm

Then the stdout should contain exactly ""<output>"".

valueoutput
foofoo
Hello, world!Hello, world!
\n\n
\t\t
\r\r
\n\t\r\n\t\r

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write 'foo)

When I successfully run stak main.scm

Then the stdout should contain exactly “foo”.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write (string->symbol ""))

When I successfully run stak main.scm

Then the stdout should contain exactly ”||”.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
#()
#(1)
#(1 2)
#(1 2 3)
#(1 #(1 2) #(3 4 5))

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write <value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
#u8()
#u8(1)
#u8(1 2)
#u8(1 2 3)

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write '(42 foo #f) (current-output-port))

When I successfully run stak main.scm

Then the stdout should contain exactly “(42 foo #f)”.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write '<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<value>”.

value
’()
`()
`(,1)
(quote)
(quasiquote)
(unquote)
(quote . 42)
(quasiquote . 42)
(unquote . 42)

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(write '<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

valueoutput
(#\a)(#\a)
(#\space)(#\space)
(“foo”)(“foo”)
((#\a))((#\a))
((#\space))((#\space))
((“foo”))((“foo”))
#(#\a)#(#\a)
#(#\space)#(#\space)
#(“foo”)#(“foo”)
#(#(#\a))#(#(#\a))
#(#(#\space))#(#(#\space))
#(#(“foo”))#(#(“foo”))

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(display '<value>)

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

valueoutput
#\aa
”foo”foo
(#\a)(a)
(#\space)( )
(“foo”)(foo)
((#\a))((a))
((#\space))(( ))
((“foo”))((foo))
#(#\a)#(a)
#(#\space)#( )
#(“foo”)#(foo)
#(#(#\a))#(#(a))
#(#(#\space))#(#( ))
#(#(“foo”))#(#(foo))

Given a file named “main.scm” with:

(import (scheme base))
(flush-output-port)

When I successfully run stak main.scm

Then the exit status should be 0.

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x (cons 42 #f))
(set-cdr! x x)
(<procedure> x)

When I successfully run stak main.scm

Then the stdout should contain exactly “#0=(42 . #0#)”.

procedure
write
write-shared

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x (cons (cons 123 #f) (cons #f 42)))
(set-cdr! (car x) x)
(set-car! (cdr x) (cdr x))
(<procedure> x)

When I successfully run stak main.scm

Then the stdout should contain exactly “#0=((123 . #0#) . #1=(#1# . 42))”.

procedure
write
write-shared

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x (vector 42 #f))
(vector-set! x 1 x)
(<procedure> x)

When I successfully run stak main.scm

Then the stdout should contain exactly “#0=#(42 #0#)”.

procedure
write
write-shared

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x (cons 42 #f))
(<procedure> (cons x x))

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

procedureoutput
write((42 . #f) 42 . #f)
write-shared(#0=(42 . #f) . #0#)

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x #(42 #f))
(<procedure> (vector x x))

When I successfully run stak main.scm

Then the stdout should contain exactly “<output>”.

procedureoutput
write#(#(42 #f) #(42 #f))
write-shared#(#0=#(42 #f) #0#)