Skip to content

cond-expand

Expand an else clause

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand
(else
(write-u8 65)))

When I successfully run scheme main.scm

Then the stdout should contain exactly “A”.

Match an implemented feature

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand
(r7rs
(write-u8 65)))

When I successfully run scheme main.scm

Then the stdout should contain exactly “A”.

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 scheme main.scm

Then the stdout should contain exactly “B”.

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 scheme main.scm

Then the stdout should contain exactly “A”.

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 scheme main.scm

Then the stdout should contain exactly “B”.

Expand an empty clause

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand (r7rs))

When I successfully run scheme main.scm

Then the exit status should be 0.

Expand an empty else clause

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand (else))

When I successfully run scheme main.scm

Then the exit status should be 0.

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 scheme main.scm

Then the stdout should contain exactly “A”.

and

Expand no requirement

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand
((and)
(write-u8 65)))

When I successfully run scheme main.scm

Then the stdout should contain exactly “A”.

Expand a requirement

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand
((and r7rs)
(write-u8 65)))

When I successfully run scheme main.scm

Then the stdout should contain exactly “A”.

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 scheme main.scm

Then the stdout should contain exactly “A”.

or

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 scheme main.scm

Then the stdout should contain exactly “B”.

Expand a requirement

Given a file named “main.scm” with:

(import (scheme base))
(cond-expand
((or r7rs)
(write-u8 65)))

When I successfully run scheme main.scm

Then the stdout should contain exactly “A”.

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 scheme main.scm

Then the stdout should contain exactly “A”.