...

Source file src/github.com/letsencrypt/boulder/canceled/canceled_test.go

Documentation: github.com/letsencrypt/boulder/canceled

     1  package canceled
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  	"testing"
     7  
     8  	"google.golang.org/grpc/codes"
     9  	"google.golang.org/grpc/status"
    10  )
    11  
    12  func TestCanceled(t *testing.T) {
    13  	if !Is(context.Canceled) {
    14  		t.Errorf("Expected context.Canceled to be canceled, but wasn't.")
    15  	}
    16  	if !Is(status.Errorf(codes.Canceled, "hi")) {
    17  		t.Errorf("Expected gRPC cancellation to be cancelled, but wasn't.")
    18  	}
    19  	if Is(errors.New("hi")) {
    20  		t.Errorf("Expected random error to not be cancelled, but was.")
    21  	}
    22  }
    23  

View as plain text