MCPcopy Index your code
hub / github.com/cweill/gotests / TestRender_TestFunction

Function TestRender_TestFunction

internal/render/render_test.go:135–165  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133}
134
135func TestRender_TestFunction(t *testing.T) {
136 r := New()
137 buf := &bytes.Buffer{}
138
139 fn := &models.Function{
140 Name: "Add",
141 IsExported: true,
142 Parameters: []*models.Field{
143 {Name: "a", Type: &models.Expression{Value: "int"}, Index: 0},
144 {Name: "b", Type: &models.Expression{Value: "int"}, Index: 1},
145 },
146 Results: []*models.Field{
147 {Type: &models.Expression{Value: "int"}, Index: 0},
148 },
149 }
150
151 err := r.TestFunction(buf, fn, false, false, false, false, false, nil, nil)
152 if err != nil {
153 t.Errorf("Render.TestFunction() error = %v", err)
154 }
155
156 output := buf.String()
157 if output == "" {
158 t.Error("Render.TestFunction() produced empty output")
159 }
160
161 // Check that output contains test function name
162 if !bytes.Contains([]byte(output), []byte("TestAdd")) {
163 t.Error("Render.TestFunction() output does not contain test function name")
164 }
165}
166
167func TestRender_TestFunction_WithOptions(t *testing.T) {
168 tests := []struct {

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
TestFunctionMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected