From 7a1540e02e4b2a13c0be5d86e804d4b2b326407d Mon Sep 17 00:00:00 2001 From: riacataquian Date: Thu, 2 Jun 2022 23:47:12 +0800 Subject: [PATCH] adds more test cases --- syntax/printer_test.go | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/syntax/printer_test.go b/syntax/printer_test.go index e7b327a2b..0fda28ac2 100644 --- a/syntax/printer_test.go +++ b/syntax/printer_test.go @@ -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) { @@ -1321,6 +1303,28 @@ func TestPrintManyStmts(t *testing.T) { {"foo\nbar <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()