| 1 | // These initial tests are for bootstrapping. They verify that we can |
| 2 | // basically use the testing infrastructure itself to check if the test |
| 3 | // system is working. |
| 4 | // |
| 5 | // These tests use will break down the test runner badly in case of |
| 6 | // errors because if they simply fail, we can't be sure the developer |
| 7 | // will ever see anything (because failing means the failing system |
| 8 | // somehow isn't working! :-) |
| 9 | // |
| 10 | // Do not assume *any* internal functionality works as expected besides |
| 11 | // what's actually tested here. |
| 12 | |
| 13 | package check_testscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/ |
| 14 | |
| 15 | import ( |
| 16 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 17 | "stringsscip-go gomod github.com/golang/go/src go1.13 strings/" |
| 18 | |
| 19 | "github.com/pingcap/checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/" |
| 20 | ) |
| 21 | |
| 22 | type BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS# struct{} |
| 23 | |
| 24 | var boostrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/boostrapS. = checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Suitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Suite().(&BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#{}) |
| 25 | |
| 26 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestCountSuitescip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestCountSuite().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 27 | suitesRunscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/suitesRun. += 1 |
| 28 | } |
| 29 | |
| 30 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestFailedAndFailscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestFailedAndFail().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 31 | if c.Failedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Failed().() { |
| 32 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().("c.Failed() must be false first!") |
| 33 | } |
| 34 | c.Failscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Fail().() |
| 35 | if !c.Failedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Failed().() { |
| 36 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().("c.Fail() didn't put the test in a failed state!") |
| 37 | } |
| 38 | c.Succeedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Succeed().() |
| 39 | } |
| 40 | |
| 41 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestFailedAndSucceedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestFailedAndSucceed().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 42 | c.Failscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Fail().() |
| 43 | c.Succeedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Succeed().() |
| 44 | if c.Failedscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Failed().() { |
| 45 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().("c.Succeed() didn't put the test back in a non-failed state") |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestLogAndGetTestLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestLogAndGetTestLog().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 50 | c.Logscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Log().("Hello there!") |
| 51 | log := c.GetTestLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#GetTestLog().() |
| 52 | if log != "Hello there!\n" { |
| 53 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("Log() or GetTestLog() is not working! Got: %#v", log)) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestLogfAndGetTestLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestLogfAndGetTestLog().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 58 | c.Logfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#Logf().("Hello %v", "there!") |
| 59 | log := c.GetTestLogscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#GetTestLog().() |
| 60 | if log != "Hello there!\n" { |
| 61 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("Logf() or GetTestLog() is not working! Got: %#v", log)) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestRunShowsErrorsscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestRunShowsErrors().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 66 | output := Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#{} |
| 67 | checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Runscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Run().(&FailHelperscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/FailHelper#{}, &checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.RunConfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#{Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output.: &output}) |
| 68 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(output.valuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#value., "Expected failure!") == -1 { |
| 69 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("RunWithWriter() output did not contain the "+ |
| 70 | "expected failure! Got: %#v", |
| 71 | output.valuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#value.)) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func (s *BootstrapSscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#) TestRunDoesntShowSuccessesscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/BootstrapS#TestRunDoesntShowSuccesses().(c *checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Cscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/C#) { |
| 76 | output := Stringscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#{} |
| 77 | checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.Runscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/Run().(&SuccessHelperscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/SuccessHelper#{}, &checkscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/.RunConfscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#{Outputscip-go gomod github.com/pingcap/check . `github.com/pingcap/check`/RunConf#Output.: &output}) |
| 78 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Indexscip-go gomod github.com/golang/go/src go1.13 strings/Index().(output.valuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#value., "Expected success!") != -1 { |
| 79 | criticalscip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/critical().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("RunWithWriter() output contained a successful "+ |
| 80 | "test! Got: %#v", |
| 81 | output.valuescip-go gomod github.com/pingcap/check . `github.com/pingcap/check_test`/String#value.)) |
| 82 | } |
| 83 | } |