MCPcopy Create free account
hub / github.com/php/frankenphp / TestExtractGoFunctionName

Function TestExtractGoFunctionName

internal/extgen/gofile_test.go:718–762  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

716}
717
718func TestExtractGoFunctionName(t *testing.T) {
719 tests := []struct {
720 name string
721 input string
722 expected string
723 }{
724 {
725 name: "simple function",
726 input: "func test() {}",
727 expected: "test",
728 },
729 {
730 name: "function with params",
731 input: "func calculate(a int, b int) int {}",
732 expected: "calculate",
733 },
734 {
735 name: "function with complex params",
736 input: "func process(data *go_string, opts *go_nullable) *go_value {}",
737 expected: "process",
738 },
739 {
740 name: "function with whitespace",
741 input: "func spacedName () {}",
742 expected: "spacedName",
743 },
744 {
745 name: "no func keyword",
746 input: "test() {}",
747 expected: "",
748 },
749 {
750 name: "empty string",
751 input: "",
752 expected: "",
753 },
754 }
755
756 for _, tt := range tests {
757 t.Run(tt.name, func(t *testing.T) {
758 result := extractGoFunctionName(tt.input)
759 assert.Equal(t, tt.expected, result)
760 })
761 }
762}
763
764func TestExtractGoFunctionSignatureParams(t *testing.T) {
765 tests := []struct {

Callers

nothing calls this directly

Calls 1

extractGoFunctionNameFunction · 0.85

Tested by

no test coverage detected