2024-07-19 08:03:35 +00:00
|
|
|
package error
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
2024-08-13 09:07:14 +00:00
|
|
|
func TestDatabase_Error(t *testing.T) {
|
|
|
|
type fields struct {
|
|
|
|
Reason string
|
2024-07-19 08:03:35 +00:00
|
|
|
}
|
|
|
|
tests := []struct {
|
2024-08-13 09:07:14 +00:00
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
want string
|
2024-07-19 08:03:35 +00:00
|
|
|
}{
|
|
|
|
{
|
2024-08-13 09:07:14 +00:00
|
|
|
name: "Test 1: Reason",
|
|
|
|
fields: fields{Reason: "TEST ERROR"},
|
|
|
|
want: "Database error: TEST ERROR",
|
2024-07-19 08:03:35 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
2024-08-13 09:07:14 +00:00
|
|
|
e := Database{
|
|
|
|
Reason: tt.fields.Reason,
|
2024-07-19 08:03:35 +00:00
|
|
|
}
|
|
|
|
if got := e.Error(); got != tt.want {
|
|
|
|
t.Errorf("Error() = %v, want %v", got, tt.want)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|