|
|
|
@ -7,10 +7,14 @@ import "testing"
|
|
|
|
import "path/filepath"
|
|
|
|
import "path/filepath"
|
|
|
|
|
|
|
|
|
|
|
|
func testGenerateRun(test *testing.T, protocol *Protocol, imports string, testCase string) {
|
|
|
|
func testGenerateRun(test *testing.T, protocol *Protocol, imports string, testCase string) {
|
|
|
|
// open files
|
|
|
|
// reset data directory
|
|
|
|
dir, err := os.MkdirTemp(os.TempDir(), "hopp-generate-test-*")
|
|
|
|
dir := "test/generate-run"
|
|
|
|
|
|
|
|
err := os.RemoveAll(dir)
|
|
|
|
if err != nil { test.Fatal(err) }
|
|
|
|
if err != nil { test.Fatal(err) }
|
|
|
|
defer os.RemoveAll(dir)
|
|
|
|
err = os.MkdirAll(dir, 0750)
|
|
|
|
|
|
|
|
if err != nil { test.Fatal(err) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// open files
|
|
|
|
sourceFile, err := os.Create(filepath.Join(dir, "protocol.go"))
|
|
|
|
sourceFile, err := os.Create(filepath.Join(dir, "protocol.go"))
|
|
|
|
if err != nil { test.Fatal(err) }
|
|
|
|
if err != nil { test.Fatal(err) }
|
|
|
|
defer sourceFile.Close()
|
|
|
|
defer sourceFile.Close()
|
|
|