mirror of https://github.com/go-gorm/gorm.git
20 lines
439 B
Go
20 lines
439 B
Go
|
package tests_test
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"testing"
|
||
|
|
||
|
"gorm.io/gorm"
|
||
|
"gorm.io/gorm/utils/tests"
|
||
|
)
|
||
|
|
||
|
func TestDialectorWithErrorTranslatorSupport(t *testing.T) {
|
||
|
translatedErr := errors.New("translated error")
|
||
|
db, _ := gorm.Open(tests.DummyDialector{TranslatedErr: translatedErr})
|
||
|
|
||
|
err := db.AddError(errors.New("some random error"))
|
||
|
if !errors.Is(err, translatedErr) {
|
||
|
t.Fatalf("expected err: %v got err: %v", translatedErr, err)
|
||
|
}
|
||
|
}
|