-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathengine_all_extensions_test.go
More file actions
49 lines (40 loc) · 1.2 KB
/
engine_all_extensions_test.go
File metadata and controls
49 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package wile_test
import (
"context"
"testing"
qt "github.com/frankban/quicktest"
"github.com/aalpar/wile"
)
func TestAllExtensions_EngineCreation(t *testing.T) {
c := qt.New(t)
ctx := context.Background()
eng, err := wile.NewEngine(ctx, wile.WithAllExtensions())
c.Assert(err, qt.IsNil)
defer eng.Close()
// Verify a primitive from each extension category exists.
for _, name := range []string{
"display", // io
"open-input-file", // files
"sin", // math
"procedure-arity", // introspection
"eval", // eval
"make-thread", // threads
"make-channel", // gointerop
"make-record-type", // all
"command-line", // system
} {
_, found := eng.Get(name)
c.Assert(found, qt.IsTrue, qt.Commentf("missing: %s", name))
}
}
func TestWithAllExtensions_EquivalentToAllExtensions(t *testing.T) {
c := qt.New(t)
ctx := context.Background()
eng, err := wile.NewEngine(ctx, wile.WithAllExtensions())
c.Assert(err, qt.IsNil)
defer eng.Close()
// Smoke test: evaluate a simple expression using a non-core primitive.
result, err := eng.Eval(ctx, eng.MustParse(ctx, "(sin 0)"))
c.Assert(err, qt.IsNil)
c.Assert(result.SchemeString(), qt.Equals, "0.0")
}