-
Notifications
You must be signed in to change notification settings - Fork 12
/
rw2_test.go
42 lines (30 loc) · 960 Bytes
/
rw2_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
package main
import (
"os"
"os/exec"
"testing"
cv "github.com/glycerine/goconvey/convey"
)
func Test015WriteRead_StructWithinStruct(t *testing.T) {
tdir := NewTempDir()
// comment the defer out to debug any rw test failures.
defer tdir.Cleanup()
err := exec.Command("cp", "rw2.go.txt", tdir.DirPath+"/rw2.go").Run()
if err != nil {
panic(err)
}
MainArgs([]string{os.Args[0], "-o", tdir.DirPath, "rw2.go.txt"})
cv.Convey("Given bambam generated go bindings: with a struct within a struct", t, func() {
cv.Convey("then we should be able to write to disk, and read back the same structure", func() {
cv.So(err, cv.ShouldEqual, nil)
tdir.MoveTo()
err = exec.Command("capnpc", "-ogo", "schema.capnp").Run()
cv.So(err, cv.ShouldEqual, nil)
err = exec.Command("go", "build").Run()
cv.So(err, cv.ShouldEqual, nil)
// run it
err = exec.Command("./" + tdir.DirPath).Run()
cv.So(err, cv.ShouldEqual, nil)
})
})
}