1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-22 15:57:07 +00:00
restic/internal/errors/fatal_test.go
Michael Eischer 2e1613d4c6 errors: Ensure that errors.IsFatal(errors.Fatal("err")) == true
This fixes a few cases where restic output "Fatal: Fatal: [...]"
2022-03-28 22:09:49 +02:00

22 lines
447 B
Go

package errors_test
import (
"testing"
"github.com/restic/restic/internal/errors"
)
func TestFatal(t *testing.T) {
for _, v := range []struct {
err error
expected bool
}{
{errors.Fatal("broken"), true},
{errors.Fatalf("broken %d", 42), true},
{errors.New("error"), false},
} {
if errors.IsFatal(v.err) != v.expected {
t.Fatalf("IsFatal for %q, expected: %v, got: %v", v.err, v.expected, errors.IsFatal(v.err))
}
}
}