2014-10-23 07:10:51 +08:00
|
|
|
package stacktrace
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestParsePackageName(t *testing.T) {
|
|
|
|
var (
|
2015-06-22 10:29:59 +08:00
|
|
|
name = "github.com/opencontainers/runc/libcontainer/stacktrace.captureFunc"
|
|
|
|
expectedPackage = "github.com/opencontainers/runc/libcontainer/stacktrace"
|
2014-10-23 07:10:51 +08:00
|
|
|
expectedFunction = "captureFunc"
|
|
|
|
)
|
|
|
|
|
|
|
|
pack, funcName := parseFunctionName(name)
|
|
|
|
if pack != expectedPackage {
|
|
|
|
t.Fatalf("expected package %q but received %q", expectedPackage, pack)
|
|
|
|
}
|
|
|
|
|
|
|
|
if funcName != expectedFunction {
|
|
|
|
t.Fatalf("expected function %q but received %q", expectedFunction, funcName)
|
|
|
|
}
|
|
|
|
}
|