aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/stub/call_test.go
blob: 67187987f88453be18bb31f96d7d2becc9bd496c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package stub_test

import (
	"reflect"
	"testing"

	"hakurei.app/container/stub"
)

func TestCallError(t *testing.T) {
	t.Run("contains false", func(t *testing.T) {
		if err := new(stub.Call).Error(true, false, true); !reflect.DeepEqual(err, stub.ErrCheck) {
			t.Errorf("Error: %#v, want %#v", err, stub.ErrCheck)
		}
	})

	t.Run("passthrough", func(t *testing.T) {
		wantErr := stub.UniqueError(0xbabe)
		if err := (&stub.Call{Err: wantErr}).Error(true); !reflect.DeepEqual(err, wantErr) {
			t.Errorf("Error: %#v, want %#v", err, wantErr)
		}
	})
}