github.com/SaurabhDubey-Groww/go-cloud@v0.0.0-20221124105541-b26c29285fd8/internal/oc/trace_test.go (about)

     1  // Copyright 2019 The Go Cloud Development Kit Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     https://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package oc
    16  
    17  import (
    18  	"regexp"
    19  	"testing"
    20  )
    21  
    22  type testDriver struct{}
    23  
    24  func TestProviderName(t *testing.T) {
    25  	for _, test := range []struct {
    26  		in   interface{}
    27  		want string
    28  	}{
    29  		{nil, ""},
    30  		{testDriver{}, "gocloud.dev/internal/oc"},
    31  		{&testDriver{}, "gocloud.dev/internal/oc"},
    32  		{regexp.Regexp{}, "regexp"},
    33  	} {
    34  		got := ProviderName(test.in)
    35  		if got != test.want {
    36  			t.Errorf("%v: got %q, want %q", test.in, got, test.want)
    37  		}
    38  	}
    39  }