MCPcopy Create free account
hub / github.com/cloudwan/gohan / TestExtensions

Function TestExtensions

extension/framework/framework.go:66–95  ·  view source on GitHub ↗

TestExtensions runs extension tests when invoked from Gohan CLI

(context *cli.Context)

Source from the content-addressed store, hash-verified

64
65// TestExtensions runs extension tests when invoked from Gohan CLI
66func TestExtensions(context *cli.Context) {
67 config := setupConfig(context)
68 hasExtTypes := context.IsSet("type")
69 runJsExt := !hasExtTypes
70 runSoExt := !hasExtTypes
71 if hasExtTypes {
72 extTypes := strings.Split(context.String("type"), ",")
73 for _, t := range extTypes {
74 switch t {
75 case "js":
76 runJsExt = true
77 case "so":
78 runSoExt = true
79 }
80 }
81 }
82 if runJsExt {
83 testFiles := getTestFiles(context.Args(), "js")
84 if ret := RunTests(testFiles, context.Bool("verbose") || config != nil, context.String("run-test"), context.Int("parallel")); ret != 0 {
85 os.Exit(ret)
86 }
87 }
88 if runSoExt {
89 testFiles := getTestFiles(context.Args(), "so")
90 if err := gorunner.NewTestRunner(testFiles, context.Bool("verbose") || config != nil, context.String("run-test"), context.Int("parallel")).Run(); err != nil {
91 log.Fatalf("%s", err.Error())
92 os.Exit(1)
93 }
94 }
95}
96
97// RunTests runs extension tests for CLI.
98func RunTests(testFiles []string, printAllLogs bool, testFilter string, workers int) (returnCode int) {

Callers

nothing calls this directly

Calls 8

setupConfigFunction · 0.85
getTestFilesFunction · 0.85
ArgsMethod · 0.80
FatalfMethod · 0.80
RunTestsFunction · 0.70
ErrorMethod · 0.65
StringMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected