(t *testing.T)
| 71 | } |
| 72 | |
| 73 | func TestPrinterPrintFileInlineHtml(t *testing.T) { |
| 74 | o := bytes.NewBufferString("") |
| 75 | |
| 76 | p := printer.NewPrinter(o) |
| 77 | p.Print(&node.Root{ |
| 78 | Stmts: []node.Node{ |
| 79 | &stmt.InlineHtml{Value: "<div>HTML</div>"}, |
| 80 | &stmt.Expression{ |
| 81 | Expr: &expr.Variable{ |
| 82 | FreeFloating: freefloating.Collection{ |
| 83 | freefloating.Start: []freefloating.String{ |
| 84 | { |
| 85 | StringType: freefloating.TokenType, |
| 86 | Value: "$", |
| 87 | }, |
| 88 | }, |
| 89 | }, |
| 90 | VarName: &node.Identifier{ |
| 91 | Value: "a", |
| 92 | }, |
| 93 | }, |
| 94 | }, |
| 95 | &stmt.InlineHtml{Value: "<div>HTML</div>"}, |
| 96 | &stmt.Expression{ |
| 97 | Expr: &expr.Variable{ |
| 98 | FreeFloating: freefloating.Collection{ |
| 99 | freefloating.Start: []freefloating.String{ |
| 100 | { |
| 101 | StringType: freefloating.TokenType, |
| 102 | Value: "$", |
| 103 | }, |
| 104 | }, |
| 105 | }, |
| 106 | VarName: &node.Identifier{ |
| 107 | Value: "a", |
| 108 | }, |
| 109 | }, |
| 110 | }, |
| 111 | }, |
| 112 | }) |
| 113 | |
| 114 | expected := `<div>HTML</div><?php $a;?><div>HTML</div><?php $a;` |
| 115 | actual := o.String() |
| 116 | |
| 117 | if expected != actual { |
| 118 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | // node |
| 123 |
nothing calls this directly
no test coverage detected
searching dependent graphs…