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

Function TestIsTopLevelKey

pkg/cli/yaml_frontmatter_utils_test.go:154–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestIsTopLevelKey(t *testing.T) {
155 tests := []struct {
156 name string
157 line string
158 expected bool
159 }{
160 {
161 name: "top level key",
162 line: "on: workflow_dispatch",
163 expected: true,
164 },
165 {
166 name: "indented key",
167 line: " contents: read",
168 expected: false,
169 },
170 {
171 name: "comment",
172 line: "# This is a comment",
173 expected: false,
174 },
175 {
176 name: "empty line",
177 line: "",
178 expected: false,
179 },
180 {
181 name: "no colon",
182 line: "just text",
183 expected: false,
184 },
185 }
186
187 for _, tt := range tests {
188 t.Run(tt.name, func(t *testing.T) {
189 result := isTopLevelKey(tt.line)
190 assert.Equal(t, tt.expected, result, "Top-level key detection should match")
191 })
192 }
193}
194
195func TestIsNestedUnder(t *testing.T) {
196 tests := []struct {

Callers

nothing calls this directly

Calls 2

isTopLevelKeyFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected