File: fatal_test.go

package info (click to toggle)
restic 0.18.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 30,824 kB
  • sloc: sh: 3,704; makefile: 50; python: 34
file content (22 lines) | stat: -rw-r--r-- 447 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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))
		}
	}
}