MCPcopy Create free account
hub / github.com/github/gh-aw / TestNormalizeSafeOutputIdentifier

Function TestNormalizeSafeOutputIdentifier

pkg/stringutil/identifiers_test.go:82–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestNormalizeSafeOutputIdentifier(t *testing.T) {
83 tests := []struct {
84 name string
85 identifier string
86 expected string
87 }{
88 {
89 name: "dash-separated to underscore",
90 identifier: "create-issue",
91 expected: "create_issue",
92 },
93 {
94 name: "already underscore-separated",
95 identifier: "create_issue",
96 expected: "create_issue",
97 },
98 {
99 name: "multiple dashes",
100 identifier: "add-comment-to-issue",
101 expected: "add_comment_to_issue",
102 },
103 {
104 name: "mixed dashes and underscores",
105 identifier: "update-pr_status",
106 expected: "update_pr_status",
107 },
108 {
109 name: "no dashes or underscores",
110 identifier: "createissue",
111 expected: "createissue",
112 },
113 {
114 name: "single dash",
115 identifier: "add-comment",
116 expected: "add_comment",
117 },
118 {
119 name: "trailing dash",
120 identifier: "update-",
121 expected: "update_",
122 },
123 {
124 name: "leading dash",
125 identifier: "-create",
126 expected: "_create",
127 },
128 {
129 name: "consecutive dashes",
130 identifier: "create--issue",
131 expected: "create__issue",
132 },
133 {
134 name: "empty string",
135 identifier: "",
136 expected: "",
137 },
138 {
139 name: "only dashes",

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected