File: exception_test.go

package info (click to toggle)
golang-raven-go 0.0~git20150721.0.74c334d-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 200 kB
  • sloc: makefile: 3; sh: 3
file content (29 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
		}
	}
}