(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func 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 | |
| 167 | func TestRender_TestFunction_WithOptions(t *testing.T) { |
| 168 | tests := []struct { |
nothing calls this directly
no test coverage detected