Codebase list golang-github-jinzhu-gorm / run/ed619cff-a78b-49a7-93b5-1e8cdd1cccd2/upstream errors_test.go
run/ed619cff-a78b-49a7-93b5-1e8cdd1cccd2/upstream

Tree @run/ed619cff-a78b-49a7-93b5-1e8cdd1cccd2/upstream (Download .tar.gz)

errors_test.go @run/ed619cff-a78b-49a7-93b5-1e8cdd1cccd2/upstreamraw · history · blame

package gorm_test

import (
	"errors"
	"testing"

	"github.com/jinzhu/gorm"
)

func TestErrorsCanBeUsedOutsideGorm(t *testing.T) {
	errs := []error{errors.New("First"), errors.New("Second")}

	gErrs := gorm.Errors(errs)
	gErrs = gErrs.Add(errors.New("Third"))
	gErrs = gErrs.Add(gErrs)

	if gErrs.Error() != "First; Second; Third" {
		t.Fatalf("Gave wrong error, got %s", gErrs.Error())
	}
}