cond-expand
Expand an else
clause
Section titled “Expand an else clause”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand (else (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Match an implemented feature
Section titled “Match an implemented feature”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand (r7rs (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Match a missing feature
Section titled “Match a missing feature”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand (foo (write-u8 65)) (else (write-u8 66)))
When I successfully run stak main.scm
Then the stdout should contain exactly “B”.
Match an implemented library
Section titled “Match an implemented library”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((library (scheme base)) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Match a missing library
Section titled “Match a missing library”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((library (scheme miracle)) (write-u8 65)) (else (write-u8 66)))
When I successfully run stak main.scm
Then the stdout should contain exactly “B”.
Expand an empty clause
Section titled “Expand an empty clause”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand (r7rs))
When I successfully run stak main.scm
Then the exit status should be 0.
Expand an empty else
clause
Section titled “Expand an empty else clause”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand (else))
When I successfully run stak main.scm
Then the exit status should be 0.
Use a not
requirement
Section titled “Use a not requirement”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((not foo) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Expand no requirement
Section titled “Expand no requirement”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((and) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Expand a requirement
Section titled “Expand a requirement”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((and r7rs) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Expand two requirements
Section titled “Expand two requirements”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((and r7rs r7rs) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Expand no requirement
Section titled “Expand no requirement”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((or) (write-u8 65)) (else (write-u8 66)))
When I successfully run stak main.scm
Then the stdout should contain exactly “B”.
Expand a requirement
Section titled “Expand a requirement”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((or r7rs) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Expand two requirements
Section titled “Expand two requirements”Given a file named “main.scm” with:
(import (scheme base))
(cond-expand ((or foo r7rs) (write-u8 65)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.