Library system
Define a library
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the exit status should be 0.
Import a library twice
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Import a procedure
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Import a macro
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Import procedures
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “AB”.
Import a procedure with a prefix
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Import only a symbol
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Import only a symbol and use one of the others
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I run scheme -l foo.scm main.scm
Then the exit status should not be 0.
Import symbols except one
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “B”.
Import symbols except one and use it
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I run scheme -l foo.scm main.scm
Then the exit status should not be 0.
Import a renamed procedure
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Nest import qualifiers
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “<output>”.
Examples
import set | symbol | output |
---|---|---|
(only (prefix (foo) my-) my-foo) | my-foo | A |
(rename (prefix (foo) my-) (my-foo my-baz)) | my-baz | A |
(except (prefix (rename (foo) (bar baz)) my-) my-foo) | my-baz | B |
Re-export an imported procedure
Given a file named “foo.scm” with:
And a file named “bar.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm -l bar.scm main.scm
Then the stdout should contain exactly “A”.
Re-export a qualified imported procedure
Given a file named “foo.scm” with:
And a file named “bar.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm -l bar.scm main.scm
Then the stdout should contain exactly “A”.
Export a renamed procedure
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “A”.
Do not modify a library environment
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “BA”.
Modify a library environment
Given a file named “foo.scm” with:
And a file named “main.scm” with:
When I successfully run scheme -l foo.scm main.scm
Then the stdout should contain exactly “AABB”.