1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-03-11 13:59:36 +02:00

30 lines
756 B
Go
Raw Normal View History

2015-09-29 18:21:17 -07:00
package raven
import (
"errors"
"testing"
)
var newExceptionTests = []struct {
err error
Exception
}{
{errors.New("foobar"), Exception{Value: "foobar", Type: "*errors.errorString"}},
{errors.New("bar: foobar"), Exception{Value: "foobar", Type: "*errors.errorString", Module: "bar"}},
}
func TestNewException(t *testing.T) {
for _, test := range newExceptionTests {
actual := NewException(test.err, nil)
if actual.Value != test.Value {
t.Errorf("incorrect Value: got %s, want %s", actual.Value, test.Value)
}
if actual.Type != test.Type {
t.Errorf("incorrect Type: got %s, want %s", actual.Type, test.Type)
}
if actual.Module != test.Module {
t.Errorf("incorrect Module: got %s, want %s", actual.Module, test.Module)
}
}
}