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

Function TestHelperFunctionsForMultiline

pkg/workflow/expressions_test.go:706–739  ·  view source on GitHub ↗

TestHelperFunctionsForMultiline tests the new helper functions

(t *testing.T)

Source from the content-addressed store, hash-verified

704
705// TestHelperFunctionsForMultiline tests the new helper functions
706func TestHelperFunctionsForMultiline(t *testing.T) {
707 t.Run("BuildDisjunction with multiline", func(t *testing.T) {
708 term1 := &ExpressionNode{Expression: "github.event_name == 'issues'", Description: "Handle issue events"}
709 term2 := &ExpressionNode{Expression: "github.event_name == 'pull_request'", Description: "Handle PR events"}
710
711 disjunction := BuildDisjunction(true, term1, term2)
712
713 if !disjunction.Multiline {
714 t.Error("Expected Multiline to be true")
715 }
716
717 expected := "# Handle issue events\ngithub.event_name == 'issues' ||\n# Handle PR events\ngithub.event_name == 'pull_request'"
718 if result := disjunction.Render(); result != expected {
719 t.Errorf("Expected '%s', got '%s'", expected, result)
720 }
721 })
722
723 t.Run("BuildDisjunction with single term", func(t *testing.T) {
724 term := &ExpressionNode{Expression: "github.event_name == 'issues'", Description: "Handle issue events"}
725
726 // Test with multiline=false
727 disjunctionSingle := BuildDisjunction(false, term)
728 expected := "github.event_name == 'issues'"
729 if result := disjunctionSingle.Render(); result != expected {
730 t.Errorf("Expected '%s', got '%s'", expected, result)
731 }
732
733 // Test with multiline=true - should still render as single term without OR
734 disjunctionMulti := BuildDisjunction(true, term)
735 if result := disjunctionMulti.Render(); result != expected {
736 t.Errorf("Expected '%s', got '%s'", expected, result)
737 }
738 })
739}
740
741func TestBuildNotFromFork(t *testing.T) {
742 result := BuildNotFromFork()

Callers

nothing calls this directly

Calls 5

BuildDisjunctionFunction · 0.85
RenderMethod · 0.65
RunMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected