cli/third-party/github.com/letsencrypt/boulder/canceled/canceled_test.go
2025-05-30 12:50:20 -04:00

22 lines
479 B
Go

package canceled
import (
"context"
"errors"
"testing"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func TestCanceled(t *testing.T) {
if !Is(context.Canceled) {
t.Errorf("Expected context.Canceled to be canceled, but wasn't.")
}
if !Is(status.Errorf(codes.Canceled, "hi")) {
t.Errorf("Expected gRPC cancellation to be cancelled, but wasn't.")
}
if Is(errors.New("hi")) {
t.Errorf("Expected random error to not be cancelled, but was.")
}
}