(t *testing.T)
| 2002 | } |
| 2003 | |
| 2004 | func TestPrinterPrintList(t *testing.T) { |
| 2005 | o := bytes.NewBufferString("") |
| 2006 | |
| 2007 | p := printer.NewPrinter(o) |
| 2008 | p.Print(&expr.List{ |
| 2009 | Items: []node.Node{ |
| 2010 | &expr.ArrayItem{ |
| 2011 | Val: &expr.Variable{ |
| 2012 | VarName: &node.Identifier{Value: "a"}, |
| 2013 | }, |
| 2014 | }, |
| 2015 | &expr.ArrayItem{ |
| 2016 | Val: &expr.List{ |
| 2017 | Items: []node.Node{ |
| 2018 | &expr.ArrayItem{ |
| 2019 | Val: &expr.Variable{ |
| 2020 | VarName: &node.Identifier{Value: "b"}, |
| 2021 | }, |
| 2022 | }, |
| 2023 | &expr.ArrayItem{ |
| 2024 | Val: &expr.Variable{ |
| 2025 | VarName: &node.Identifier{Value: "c"}, |
| 2026 | }, |
| 2027 | }, |
| 2028 | }, |
| 2029 | }, |
| 2030 | }, |
| 2031 | }, |
| 2032 | }) |
| 2033 | |
| 2034 | expected := `list($a,list($b,$c))` |
| 2035 | actual := o.String() |
| 2036 | |
| 2037 | if expected != actual { |
| 2038 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2039 | } |
| 2040 | } |
| 2041 | |
| 2042 | func TestPrinterPrintMethodCall(t *testing.T) { |
| 2043 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…