Skip to content

Tools

Given I run the following script:

Terminal window
cp $STAK_ROOT/prelude.scm .

And the exit status should be 0.

When I successfully run \<command\> --version

Then the stdout should contain “<command> “.

command
stak
stak-compile
stak-interpret
stak-repl

Given a file named “main.scm” with:

(import (scheme base))

When I run stak main.scm \<option\>

Then the exit status should be 1

And the stderr should contain “Error: out of memory”.

option
-s 0
–heap-size 0

Given a file named “main.scm” with:

(import (scheme base))

And I run the following script:

Terminal window
cat prelude.scm main.scm | stak-compile > main.bc

When I run stak-interpret \<option\> main.bc

Then the exit status should be 1

And the stderr should contain “Error: out of memory”.

option
-s 0
–heap-size 0

Given a file named “main.scm” with:

(import (scheme base) (scheme cxr) (scheme process-context))
(write-string (caddr (command-line)))

When I successfully run stak main.scm -- --version

Then the stdout should contain exactly “–version”.

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context))
(write-string (cadr (command-line)))

And I run the following script:

Terminal window
cat prelude.scm main.scm | stak-compile > main.bc

When I successfully run stak-interpret main.bc --version

Then the stdout should contain exactly “–version”.

Strip options from a command line of bytecode

Section titled “Strip options from a command line of bytecode”

Given a file named “main.scm” with:

(import (scheme base) (scheme process-context) (scheme write))
(write (command-line))

And I run the following script:

Terminal window
cat prelude.scm main.scm | stak-compile > main.bc

When I successfully run stak-interpret -s 1000000 main.bc foo

Then the stdout should contain exactly:

("main.bc" "foo")

When I run stak-interpret

Then the exit status should be 1

And the stderr should contain “Error: bytecode file missing”.

When I run stak-interpret foo.bc

Then the exit status should be 1

And the stderr should contain “Error: “.