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

Function TestHasExitedBlock

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

Source from the content-addressed store, hash-verified

234}
235
236func TestHasExitedBlock(t *testing.T) {
237 tests := []struct {
238 name string
239 line string
240 blockIndent string
241 expected bool
242 }{
243 {
244 name: "exited with top-level key",
245 line: "permissions:",
246 blockIndent: " ",
247 expected: true,
248 },
249 {
250 name: "still in block - more indentation",
251 line: " nested: value",
252 blockIndent: " ",
253 expected: false,
254 },
255 {
256 name: "exited with comment at same level",
257 line: " # Comment",
258 blockIndent: " ",
259 expected: true,
260 },
261 {
262 name: "still in block - nested comment",
263 line: " # Nested comment",
264 blockIndent: " ",
265 expected: false,
266 },
267 {
268 name: "empty line",
269 line: "",
270 blockIndent: " ",
271 expected: false,
272 },
273 }
274
275 for _, tt := range tests {
276 t.Run(tt.name, func(t *testing.T) {
277 result := hasExitedBlock(tt.line, tt.blockIndent)
278 assert.Equal(t, tt.expected, result, "Block exit detection should match")
279 })
280 }
281}
282
283func TestFindAndReplaceInLine(t *testing.T) {
284 tests := []struct {

Callers

nothing calls this directly

Calls 2

hasExitedBlockFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected