MCPcopy
hub / github.com/tinygo-org/tinygo / Run

Method Run

src/testing/testing.go:500–529  ·  view source on GitHub ↗

Run runs f as a subtest of t called name. It waits until the subtest is finished and returns whether the subtest succeeded.

(name string, f func(t *T))

Source from the content-addressed store, hash-verified

498// Run runs f as a subtest of t called name. It waits until the subtest is finished
499// and returns whether the subtest succeeded.
500func (t *T) Run(name string, f func(t *T)) bool {
501 t.hasSub = true
502 testName, ok, _ := t.context.match.fullName(&t.common, name)
503 if !ok {
504 return true
505 }
506
507 // Create a subtest.
508 ctx, cancelCtx := context.WithCancel(context.Background())
509 sub := T{
510 common: common{
511 output: &logger{logToStdout: flagVerbose},
512 name: testName,
513 parent: &t.common,
514 level: t.level + 1,
515 ctx: ctx,
516 cancelCtx: cancelCtx,
517 },
518 context: t.context,
519 }
520 if t.level > 0 {
521 sub.indent = sub.indent + " "
522 }
523 if flagVerbose {
524 fmt.Fprintf(t.output, "=== RUN %s\n", sub.name)
525 }
526
527 tRunner(&sub, f)
528 return !sub.failed
529}
530
531// Deadline reports the time at which the test binary will have
532// exceeded the timeout specified by the -timeout flag.

Callers 15

runTestsFunction · 0.95
TestTracebackFunction · 0.45
TestErrorsFunction · 0.45
TestCorpusFunction · 0.45
TestBuildFunction · 0.45
runPlatTestsFunction · 0.45
runTestWithConfigFunction · 0.45
TestWebAssemblyFunction · 0.45
TestWasmExportFunction · 0.45
TestWasmFuncOfFunction · 0.45
TestWasmExportJSFunction · 0.45
TestWasmExitFunction · 0.45

Calls 2

tRunnerFunction · 0.85
fullNameMethod · 0.80

Tested by 15

TestTracebackFunction · 0.36
TestErrorsFunction · 0.36
TestCorpusFunction · 0.36
TestBuildFunction · 0.36
runPlatTestsFunction · 0.36
runTestWithConfigFunction · 0.36
TestWebAssemblyFunction · 0.36
TestWasmExportFunction · 0.36
TestWasmFuncOfFunction · 0.36
TestWasmExportJSFunction · 0.36
TestWasmExitFunction · 0.36
TestTestFunction · 0.36