(t *testing.T)
| 1858 | } |
| 1859 | |
| 1860 | func TestPrintExprShortArray(t *testing.T) { |
| 1861 | o := bytes.NewBufferString("") |
| 1862 | |
| 1863 | p := printer.NewPrettyPrinter(o, " ") |
| 1864 | p.Print(&expr.ShortArray{ |
| 1865 | Items: []node.Node{ |
| 1866 | &expr.ArrayItem{ |
| 1867 | Key: &scalar.String{Value: "'Hello'"}, |
| 1868 | Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}}, |
| 1869 | }, |
| 1870 | &expr.ArrayItem{ |
| 1871 | Key: &scalar.Lnumber{Value: "2"}, |
| 1872 | Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}}}, |
| 1873 | }, |
| 1874 | &expr.ArrayItem{ |
| 1875 | Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}}, |
| 1876 | }, |
| 1877 | }, |
| 1878 | }) |
| 1879 | |
| 1880 | expected := `['Hello' => $world, 2 => &$var, $var]` |
| 1881 | actual := o.String() |
| 1882 | |
| 1883 | if expected != actual { |
| 1884 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | func TestPrintShortList(t *testing.T) { |
| 1889 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…