MCPcopy Create free account
hub / github.com/larksuite/cli / TestExitCodeForCategory

Function TestExitCodeForCategory

internal/output/exitcode_test.go:13–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestExitCodeForCategory(t *testing.T) {
14 cases := []struct {
15 name string
16 cat errs.Category
17 want int
18 }{
19 {"validation", errs.CategoryValidation, 2},
20 {"authentication", errs.CategoryAuthentication, 3},
21 {"authorization", errs.CategoryAuthorization, 3},
22 {"config", errs.CategoryConfig, 3},
23 {"network", errs.CategoryNetwork, 4},
24 {"api", errs.CategoryAPI, 1},
25 {"policy", errs.CategoryPolicy, 6},
26 {"internal", errs.CategoryInternal, 5},
27 {"confirmation", errs.CategoryConfirmation, 10},
28 }
29 for _, tc := range cases {
30 t.Run(tc.name, func(t *testing.T) {
31 if got := ExitCodeForCategory(tc.cat); got != tc.want {
32 t.Errorf("ExitCodeForCategory(%q) = %d, want %d", tc.cat, got, tc.want)
33 }
34 })
35 }
36}
37
38func TestExitCodeForCategory_UnknownDefaults(t *testing.T) {
39 if got := ExitCodeForCategory(errs.Category("not_a_real_category")); got != ExitInternal {

Callers

nothing calls this directly

Calls 2

ExitCodeForCategoryFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected