mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 11:48:43 -07:00
-Test coverage was no longer triggered due to the check for BUILD_GOOS environment variable that was removed. Removed the check. -Re-run test package with server code coverage. -Remove unused functions in test.go. -Add test for a function in test.go. -Add missing parse +OK test.
32 lines
615 B
Go
32 lines
615 B
Go
// Copyright 2016 Apcera Inc. All rights reserved.
|
|
|
|
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
type dummyLogger struct {
|
|
msg string
|
|
}
|
|
|
|
func (d *dummyLogger) Fatalf(format string, args ...interface{}) {
|
|
d.msg = fmt.Sprintf(format, args...)
|
|
|
|
}
|
|
func (d *dummyLogger) Errorf(format string, args ...interface{}) {
|
|
}
|
|
|
|
func TestStackFatal(t *testing.T) {
|
|
d := &dummyLogger{}
|
|
stackFatalf(d, "test stack %d", 1)
|
|
if !strings.HasPrefix(d.msg, "test stack 1") {
|
|
t.Fatalf("Unexpected start of stack: %v", d.msg)
|
|
}
|
|
if !strings.Contains(d.msg, "test_test.go") {
|
|
t.Fatalf("Unexpected stack: %v", d.msg)
|
|
}
|
|
}
|