github.com/go-kivik/kivik/v4@v4.3.2/kiviktest/go18testing.go (about) 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.8 && !go1.9 14 15 package kiviktest 16 17 import ( 18 "io" 19 "os" 20 "regexp" 21 "testing" 22 ) 23 24 /* This file contains copies of basic functionality from the testing package */ 25 26 // testDeps is a copy of testing.testDeps 27 type testDeps interface { 28 MatchString(pat, str string) (bool, error) 29 StartCPUProfile(io.Writer) error 30 StopCPUProfile() 31 WriteHeapProfile(io.Writer) error 32 WriteProfileTo(string, io.Writer, int) error 33 } 34 35 type deps struct{} 36 37 var _ testDeps = &deps{} 38 39 func (d *deps) MatchString(pat, str string) (bool, error) { return regexp.MatchString(pat, str) } 40 func (d *deps) StartCPUProfile(_ io.Writer) error { return nil } 41 func (d *deps) StopCPUProfile() {} 42 func (d *deps) WriteHeapProfile(_ io.Writer) error { return nil } 43 func (d *deps) WriteProfileTo(_ string, _ io.Writer, _ int) error { return nil } 44 45 func mainStart(tests []testing.InternalTest) { 46 m := testing.MainStart(&deps{}, tests, nil, nil) 47 os.Exit(m.Run()) 48 }