When I try and run my Go test file, I get some errors.
This is the test file:
package rb_database
import (
"system"
"testing"
"time"
)
func TestGetBinContentsResult(t *testing.T) {
errCount := 0
currentTime := time.Now()
gbcr := new(getBinContentsResult)
ids := make([]system.ID, 5, 5)
for i := 0; i < 5; i++ {
ids[i] = system.GenerateNewID()
}
copy(gbcr.deletedIds, ids)
gbcr.earliestRecordDeletedDate = currentTime
//Test functions
for j := 0; j < len(gbcr.DeletedIDs()); j++ {
if gbcr.DeletedIDs()[j] != ids[j] {
t.Error("Element " + j + " in ID array not equal to value set. Expected Value: " + ids[j] + ". Actual Value: " + gbcr.DeletedIDs()[j])
t.Fail()
errCount++
}
}
if gbcr.EarliestRecordDeletedDate() != currentTime {
t.Error("Earliest record time not equal to value set. Expected Value: " + currentTime + ". Actual Value: " + gbcr.EarliestRecordDeletedDate())
t.Fail()
errCount++
}
if t.Failed() {
t.Log("Test failed: TestGetBinContentsResult. " + errCount + "/6 possible errors occured.")
} else {
t.Log("Test passed: TestGetBinContentsResult. ")
}
}
I'm using LiteIDE 27.1 and Go 1.3.3. I have made sure my GOPATH and GOROOT are set to my project directory and the Go install directory respectively.
The build output when I run TestAll is:
C:/Go/bin/go.exe test -v [C:/Users/Adam/workspace/RedboltMarch/src/rb_database]
# rb_database
get_updated_result_test.go:18:9: expected ')', found ':='
get_updated_result_test.go:49:2: expected '}', found 'EOF'
FAIL rb_database [setup failed]
Error: process exited with code 1.
When I build and run the program normally:
C:/Go/bin/go.exe build -i [C:/Users/Adam/workspace/RedboltMarch/src/rb_database]
Success: process exited with code 0.
rb_database [C:/Users/Adam/workspace/RedboltMarch/src/rb_database]
Error: process failed to start.
Aucun commentaire:
Enregistrer un commentaire