generate: Fix testGenerateRun so that it actually works
This commit is contained in:
parent
a9d5bb83a2
commit
c70c23d137
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/generate/test
|
||||||
@ -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()
|
||||||