(t *testing.T)
| 3199 | } |
| 3200 | |
| 3201 | func TestPrintStmtFunction(t *testing.T) { |
| 3202 | o := bytes.NewBufferString("") |
| 3203 | |
| 3204 | p := printer.NewPrettyPrinter(o, " ") |
| 3205 | p.Print(&stmt.Namespace{ |
| 3206 | Stmts: []node.Node{ |
| 3207 | &stmt.Function{ |
| 3208 | ReturnsRef: true, |
| 3209 | FunctionName: &node.Identifier{Value: "foo"}, |
| 3210 | Params: []node.Node{ |
| 3211 | &node.Parameter{ |
| 3212 | ByRef: true, |
| 3213 | Variadic: false, |
| 3214 | Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}}, |
| 3215 | }, |
| 3216 | }, |
| 3217 | ReturnType: &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "Foo"}}}, |
| 3218 | Stmts: []node.Node{ |
| 3219 | &stmt.Nop{}, |
| 3220 | }, |
| 3221 | }, |
| 3222 | }, |
| 3223 | }) |
| 3224 | |
| 3225 | expected := `namespace { |
| 3226 | function &foo(&$var): \Foo { |
| 3227 | ; |
| 3228 | } |
| 3229 | }` |
| 3230 | actual := o.String() |
| 3231 | |
| 3232 | if expected != actual { |
| 3233 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 3234 | } |
| 3235 | } |
| 3236 | |
| 3237 | func TestPrintStmtGlobal(t *testing.T) { |
| 3238 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…