-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimport_test.go
57 lines (39 loc) · 1.09 KB
/
import_test.go
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
50
51
52
53
54
55
56
57
package denada
import "testing"
import . "github.com/onsi/gomega"
var importTest = `
import(file="testsuite/case1.dnd", recursive=false);
import(file="testsuite/case1.dnd");
scoped {
import(file="testsuite/case2.dnd", recursive=true);
}
`
var expectedResult = `
// Most basic syntactic example with just 2 declarations
props(declarations=2);
Real r;
// Most basic syntactic example with just 2 declarations
props(declarations=2);
Real r;
scoped {
// Checking against a grammar file with different expression types
props(grammar="config.grm", definitions=1, declarations=1) "props";
section Foo "section" {
x = 1 "section.variable";
y = 1.0 "section.variable";
z = "test string" "section.variable";
json = {"this": "is a JSON expression!"} "section.variable";
}
}
`
func Test_NonRecursiveImport(t *testing.T) {
RegisterTestingT(t)
exp, err := ParseString(expectedResult)
Expect(err).To(BeNil())
raw, err := ParseString(importTest)
Expect(err).To(BeNil())
elab, err := ImportTransform(raw)
Expect(err).To(BeNil())
eq := elab.Equals(exp)
Expect(eq).To(BeNil())
}