Skip to content

Exit

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure>)
(write-u8 65)

When I successfully run stak main.scm

Then the stdout should contain exactly “”.

procedure
exit
emergency-exit

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure> #t)

When I successfully run stak main.scm

Then the exit status should be 0.

procedure
exit
emergency-exit

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure> #f)

When I run stak main.scm

Then the exit status should not be 0.

procedure
exit
emergency-exit

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure> 0)

When I successfully run stak main.scm

Then the exit status should be 0.

procedure
exit
emergency-exit

Exit an interpreter with a non-zero integer

Section titled “Exit an interpreter with a non-zero integer”

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure> 42)

When I run stak main.scm

Then the exit status should be 42.

procedure
exit
emergency-exit

Exit an interpreter with a non-integer value

Section titled “Exit an interpreter with a non-integer value”

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(<procedure> 'foo)

When I run stak main.scm

Then the exit status should not be 0.

procedure
exit
emergency-exit

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(dynamic-wind
(lambda () (write-u8 65))
(lambda () (exit))
(lambda () (write-u8 66)))

When I successfully run stak main.scm

Then the stdout should contain exactly “AB”.

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(dynamic-wind
(lambda () #f)
(lambda () (emergency-exit))
(lambda () (write-u8 65)))

When I successfully run stak main.scm

Then the stdout should contain exactly “”.