Tools
Background
Section titled “Background”Given I run the following script:
cp $STAK_ROOT/prelude.scm .And the exit status should be 0.
Show a version
Section titled “Show a version”When I successfully run \<command\> --version
Then the stdout should contain “<command> “.
Examples
Section titled “Examples”| command |
|---|
| stak |
| stak-compile |
| stak-interpret |
| stak-repl |
Set a heap size
Section titled “Set a heap size”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”.
Examples
Section titled “Examples”| option |
|---|
| -s 0 |
| –heap-size 0 |
Set a heap size for bytecode
Section titled “Set a heap size for bytecode”Given a file named “main.scm” with:
(import (scheme base))And I run the following script:
cat prelude.scm main.scm | stak-compile > main.bcWhen I run stak-interpret \<option\> main.bc
Then the exit status should be 1
And the stderr should contain “Error: out of memory”.
Examples
Section titled “Examples”| option |
|---|
| -s 0 |
| –heap-size 0 |
Pass an option to a script
Section titled “Pass an option to a script”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”.
Pass an option to bytecode
Section titled “Pass an option to bytecode”Given a file named “main.scm” with:
(import (scheme base) (scheme process-context))
(write-string (cadr (command-line)))And I run the following script:
cat prelude.scm main.scm | stak-compile > main.bcWhen 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:
cat prelude.scm main.scm | stak-compile > main.bcWhen I successfully run stak-interpret -s 1000000 main.bc foo
Then the stdout should contain exactly:
("main.bc" "foo")Interpret no bytecode file
Section titled “Interpret no bytecode file”When I run stak-interpret
Then the exit status should be 1
And the stderr should contain “Error: bytecode file missing”.
Interpret a nonexistent bytecode file
Section titled “Interpret a nonexistent bytecode file”When I run stak-interpret foo.bc
Then the exit status should be 1
And the stderr should contain “Error: “.