Skip to content

Commit

Permalink
adds more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
riacataquian committed Jun 2, 2022
1 parent 52458f0 commit 7a1540e
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions syntax/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,24 +616,6 @@ var printTests = []printCase{
"`declare`",
"$(declare)",
},
{
"(\n(foo >redir)\n)",
"(\n\t(foo >redir)\n)",
},
{
"( (foo) )",
"( (foo))",
},
{
"( {foo}; bar; )",
"(\n\t{foo}\n\tbar\n)",
},
{
"( ((foo++)) )",
"( ((foo++)))",
},
samePrint("(\n\t((foo++))\n)"),
samePrint("(foo && bar)"),
}

func TestPrintWeirdFormat(t *testing.T) {
Expand Down Expand Up @@ -1321,6 +1303,28 @@ func TestPrintManyStmts(t *testing.T) {
{"foo\nbar <<EOF\nbody\nEOF\n", "foo\nbar <<EOF\nbody\nEOF\n"},
{"foo\nbar # inline", "foo\nbar # inline\n"},
{"# comment before\nfoo bar", "# comment before\nfoo bar\n"},
{
"(\n(foo >redir)\n)",
"(\n\t(foo >redir)\n)\n",
},
{
"( (foo) )",
"( (foo))\n",
},
{
"( (foo); bar )",
"(\n\t(foo)\n\tbar\n)\n",
},
{
"( ((foo++)) )",
"( ((foo++)))\n",
},
{
"( ((foo++)); bar )",
"(\n\t((foo++))\n\tbar\n)\n",
},
samePrint("(\n\t((foo++))\n)\n"),
samePrint("(foo && bar)\n"),
}
parser := NewParser(KeepComments(true))
printer := NewPrinter()
Expand Down

0 comments on commit 7a1540e

Please sign in to comment.