$99 GRAYBYTE WORDPRESS FILE MANAGER $24

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 2.57.91.174 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/errors/

HOME
Current File : /opt/go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/errors//errors_test.go
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package errors

import (
	"errors"
	"strings"
	"testing"
)

func TestErrors(t *testing.T) {
	var sentinel = New("sentinel")
	var foreign = errors.New("foreign")
	for _, test := range []struct {
		what     string
		err      error
		wantText string
		is       []error
		isNot    []error
	}{{
		what:     `New("abc")`,
		err:      New("abc"),
		wantText: "abc",
	}, {
		what:     `New("%v", sentinel)`,
		err:      New("%v", sentinel),
		wantText: "sentinel",
		isNot:    []error{sentinel},
	}, {
		what:     `Wrap(sentinel, "%v", "text")`,
		err:      Wrap(sentinel, "%v", "text"),
		wantText: "text: sentinel",
		is:       []error{sentinel},
	}, {
		what:     `New("%v", foreign)`,
		err:      New("%v", foreign),
		wantText: "foreign",
		isNot:    []error{foreign},
	}, {
		what:     `Wrap(foreign, "%v", "text")`,
		err:      Wrap(foreign, "%v", "text"),
		wantText: "text: foreign",
		is:       []error{foreign},
	}} {
		if got, want := test.err.Error(), prefix; !strings.HasPrefix(got, want) {
			t.Errorf("%v.Error() = %q, want prefix %q", test.what, got, want)
		}
		if got, want := test.err.Error(), prefix+test.wantText; got != want {
			t.Errorf("%v.Error() = %q, want %q", test.what, got, want)
		}
		if got, want := Is(test.err, Error), true; got != want {
			t.Errorf("errors.Is(%v, errors.Error) = %v, want %v", test.what, got, want)
		}
		for _, err := range test.is {
			if got, want := Is(test.err, err), true; got != want {
				t.Errorf("errors.Is(%v, %v) = %v, want %v", test.what, err, got, want)
			}
		}
		for _, err := range test.isNot {
			if got, want := Is(test.err, err), false; got != want {
				t.Errorf("errors.Is(%v, %v) = %v, want %v", test.what, err, got, want)
			}
		}
	}
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 Jan 2024 4.43 PM
root / root
0555
errors.go
2.065 KB
25 Jan 2024 4.43 PM
root / root
0444
errors_test.go
1.823 KB
25 Jan 2024 4.43 PM
root / root
0444
is_go112.go
0.76 KB
25 Jan 2024 4.43 PM
root / root
0444
is_go113.go
0.308 KB
25 Jan 2024 4.43 PM
root / root
0444

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF