TestMain not run
Date : March 29 2020, 07:55 AM
To fix the issue you can do TestMain is only executed in test files (suffix _test.go). Move the function to the repository_test.go file to fix this.
|
TestMain - no tests to run
Tag : go , By : techthumb
Date : March 29 2020, 07:55 AM
I wish this help you Odds are, your problems are around the mode value you're passing to os.Mkdir(...). You're providing 666 decimal, which is 01232 octal (or if you prefer, a permissions string of d-w--wx-wT) which I assume is not really what you're looking for. Instead of 666, you should specify 0666 -- the leading 0 indicates your value is in octal notation. package gcc
import (
"testing"
"path/filepath"
"os"
)
const testoutput = "testoutput"
type testcase struct {
inFile string
outFile string
err error
}
func (tc *testcase) test(t *testing.T) {
var (
in = filepath.Join("testdata", tc.inFile)
out = filepath.Join(testoutput, tc.outFile)
)
if err := Compile(in, out); err != tc.err {
t.Errorf("Compile(%q, %q) == %v; Wanted %v", in, out, err, tc.err)
}
}
func TestCompile(t *testing.T) {
os.Mkdir(testoutput, 0666)
tests := map[string]*testcase{
"correct": &testcase{"correct.c", "correct_out", nil},
"wrong": &testcase{"wrong.c", "wrong_out", expectedError},
}
for name, tc := range tests {
t.Run(name, tc.test)
}
}
|
Unable to run packaged TestMain.java
Date : March 29 2020, 07:55 AM
|
TestMain multiple definitions found
Date : March 29 2020, 07:55 AM
|
Function TestMain didn't run
Tag : go , By : adrianmooreuk
Date : January 02 2021, 06:48 AM
fixed the issue. Will look into that further The TestMain function is local to a test package. func TestMain(m *testing.M)
|