1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5//+build go1.13
6
7package xerrors_test
8
9import (
10	"errors"
11	"testing"
12
13	"golang.org/x/xerrors"
14)
15
16func TestErrorsIs(t *testing.T) {
17	var errSentinel = errors.New("sentinel")
18
19	got := errors.Is(xerrors.Errorf("%w", errSentinel), errSentinel)
20	if !got {
21		t.Error("got false, want true")
22	}
23
24	got = errors.Is(xerrors.Errorf("%w: %s", errSentinel, "foo"), errSentinel)
25	if !got {
26		t.Error("got false, want true")
27	}
28}
29