...

Source file src/github.com/go-kivik/kivik/v4/kiviktest/go110testing.go

Documentation: github.com/go-kivik/kivik/v4/kiviktest

     1  // Licensed under the Apache License, Version 2.0 (the "License"); you may not
     2  // use this file except in compliance with the License. You may obtain a copy of
     3  // the License at
     4  //
     5  //  http://www.apache.org/licenses/LICENSE-2.0
     6  //
     7  // Unless required by applicable law or agreed to in writing, software
     8  // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     9  // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    10  // License for the specific language governing permissions and limitations under
    11  // the License.
    12  
    13  //go:build go1.10 && !go1.18
    14  
    15  package kiviktest
    16  
    17  import (
    18  	"io"
    19  	"os"
    20  	"regexp"
    21  	"testing"
    22  )
    23  
    24  // testDeps is a copy of testing.testDeps
    25  type testDeps interface {
    26  	ImportPath() string
    27  	MatchString(pat, str string) (bool, error)
    28  	StartCPUProfile(io.Writer) error
    29  	StopCPUProfile()
    30  	StartTestLog(io.Writer)
    31  	StopTestLog() error
    32  	WriteHeapProfile(io.Writer) error
    33  	WriteProfileTo(string, io.Writer, int) error
    34  	SetPanicOnExit0(bool)
    35  }
    36  
    37  type deps struct{}
    38  
    39  var _ testDeps = &deps{}
    40  
    41  func (d *deps) MatchString(pat, str string) (bool, error)         { return regexp.MatchString(pat, str) }
    42  func (d *deps) StartCPUProfile(_ io.Writer) error                 { return nil }
    43  func (d *deps) StopCPUProfile()                                   {}
    44  func (d *deps) WriteHeapProfile(_ io.Writer) error                { return nil }
    45  func (d *deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil }
    46  func (d *deps) ImportPath() string                                { return "" }
    47  func (d *deps) StartTestLog(io.Writer)                            {}
    48  func (d *deps) StopTestLog() error                                { return nil }
    49  func (d *deps) SetPanicOnExit0(bool)                              {}
    50  
    51  func mainStart(tests []testing.InternalTest) {
    52  	m := testing.MainStart(&deps{}, tests, nil, nil)
    53  	os.Exit(m.Run())
    54  }
    55  

View as plain text