Inclusion
Include a file
Section titled “Include a file”Given a file named “main.scm” with:
(import (scheme base))
(include "<path>")And a file named “foo.scm” with:
(write-string "foo")When I successfully run stak main.scm
Then the stdout should contain exactly “foo”.
Examples
Section titled “Examples”| path |
|---|
| foo.scm |
| ./foo.scm |
Include two files
Section titled “Include two files”Given a file named “main.scm” with:
(import (scheme base))
(include "foo.scm")(include "bar.scm")And a file named “foo.scm” with:
(write-string "foo")And a file named “bar.scm” with:
(write-string "bar")When I successfully run stak main.scm
Then the stdout should contain exactly “foobar”.
Include a file in an included file
Section titled “Include a file in an included file”Given a file named “main.scm” with:
(import (scheme base))
(include "foo.scm")And a file named “foo.scm” with:
(include "bar.scm")And a file named “bar.scm” with:
(write-string "bar")When I successfully run stak main.scm
Then the stdout should contain exactly “bar”.
Include a file in a directory in an included file
Section titled “Include a file in a directory in an included file”Given a file named “main.scm” with:
(import (scheme base))
(include "foo/bar.scm")And a file named “foo/bar.scm” with:
(include "<path>")And a file named “foo/baz.scm” with:
(write-string "baz")When I successfully run stak main.scm
Then the stdout should contain exactly “baz”.
Examples
Section titled “Examples”| path |
|---|
| baz.scm |
| ./baz.scm |