SoXX
75bbbb4408
Some checks failed
Gitea Build Check / Build (push) Failing after 26s
refactored & fixed old test cases
31 lines
537 B
Go
31 lines
537 B
Go
package error
|
|
|
|
import "testing"
|
|
|
|
func TestDatabase_Error(t *testing.T) {
|
|
type fields struct {
|
|
Reason string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want string
|
|
}{
|
|
{
|
|
name: "Test 1: Reason",
|
|
fields: fields{Reason: "TEST ERROR"},
|
|
want: "Database error: TEST ERROR",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
e := Database{
|
|
Reason: tt.fields.Reason,
|
|
}
|
|
if got := e.Error(); got != tt.want {
|
|
t.Errorf("Error() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|