1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:44:42 -07:00

syslog: fix skipping of net tests

Also remove some left over copy & paste
in the test of reflect.Copy for arrays.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4431074
This commit is contained in:
Gustavo Niemeyer 2011-04-28 14:16:41 -03:00
parent 8133cb3565
commit 3e9a1d50db
2 changed files with 18 additions and 10 deletions

View File

@ -579,13 +579,7 @@ func TestCopyArray(t *testing.T) {
}
for i := len(a); i < len(b); i++ {
if b[i] != c[i] {
if i < len(a) {
t.Errorf("(ii) a[%d]=%d, b[%d]=%d, c[%d]=%d",
i, a[i], i, b[i], i, c[i])
} else {
t.Errorf("(iii) b[%d]=%d, c[%d]=%d",
i, b[i], i, c[i])
}
t.Errorf("(ii) b[%d]=%d, c[%d]=%d", i, b[i], i, c[i])
} else {
t.Logf("elem %d is okay\n", i)
}

View File

@ -35,7 +35,19 @@ func startServer(done chan<- string) {
go runSyslog(c, done)
}
func skipNetTest(t *testing.T) bool {
if testing.Short() {
// Depends on syslog daemon running, and sometimes it's not.
t.Logf("skipping syslog test during -short")
return true
}
return false
}
func TestNew(t *testing.T) {
if skipNetTest(t) {
return
}
s, err := New(LOG_INFO, "")
if err != nil {
t.Fatalf("New() failed: %s", err)
@ -45,6 +57,9 @@ func TestNew(t *testing.T) {
}
func TestNewLogger(t *testing.T) {
if skipNetTest(t) {
return
}
f := NewLogger(LOG_INFO, 0)
if f == nil {
t.Error("NewLogger() failed")
@ -52,9 +67,8 @@ func TestNewLogger(t *testing.T) {
}
func TestDial(t *testing.T) {
if testing.Short() {
// Depends on syslog daemon running, and sometimes it's not.
t.Logf("skipping syslog test during -short")
if skipNetTest(t) {
return
}
l, err := Dial("", "", LOG_ERR, "syslog_test")
if err != nil {