MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestPrintFileInlineHtml

Function TestPrintFileInlineHtml

printer/pretty_printer_test.go:86–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestPrintFileInlineHtml(t *testing.T) {
87 o := bytes.NewBufferString("")
88
89 p := printer.NewPrettyPrinter(o, " ")
90 p.Print(&node.Root{
91 Stmts: []node.Node{
92 &stmt.InlineHtml{Value: "<div>HTML</div>"},
93 &stmt.Expression{
94 Expr: &scalar.Heredoc{
95 Label: "<<<\"LBL\"\n",
96 Parts: []node.Node{
97 &scalar.EncapsedStringPart{Value: "hello world\n"},
98 },
99 },
100 },
101 },
102 })
103
104 expected := `<div>HTML</div><?php
105<<<"LBL"
106hello world
107LBL;
108`
109 actual := o.String()
110
111 if expected != actual {
112 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
113 }
114}
115
116// node
117

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrettyPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…