actually run fmt tests and then remove debug statements

This commit is contained in:
Adrien Delorme 2021-03-15 11:41:14 +01:00
parent 22d373c279
commit 832c0f2b2a
3 changed files with 3 additions and 3 deletions

View File

@ -87,6 +87,8 @@ func TestHelperProcess(*testing.T) {
switch cmd { switch cmd {
case "console": case "console":
os.Exit((&ConsoleCommand{Meta: commandMeta()}).Run(args)) os.Exit((&ConsoleCommand{Meta: commandMeta()}).Run(args))
case "fmt":
os.Exit((&FormatCommand{Meta: commandMeta()}).Run(args))
case "inspect": case "inspect":
os.Exit((&InspectCommand{Meta: commandMeta()}).Run(args)) os.Exit((&InspectCommand{Meta: commandMeta()}).Run(args))
case "build": case "build":

View File

@ -151,7 +151,7 @@ func Test_fmt_pipe(t *testing.T) {
env []string env []string
expected string expected string
}{ }{
{unformattedHCL, []string{"fmt", "-"}, nil, formattedHCL + "\n"}, {unformattedHCL, []string{"fmt", "-"}, nil, formattedHCL},
} }
for _, tc := range tc { for _, tc := range tc {

View File

@ -69,9 +69,7 @@ func (f *HCL2Formatter) Format(path string) (int, hcl.Diagnostics) {
f.parser = hclparse.NewParser() f.parser = hclparse.NewParser()
} }
fmt.Println(fmt.Sprintf("Path is %s", path))
if path == "-" { if path == "-" {
fmt.Println("Found right statement!!!!!")
bytesModified, diags = f.formatFile(path, diags, bytesModified) bytesModified, diags = f.formatFile(path, diags, bytesModified)
return bytesModified, diags return bytesModified, diags
} else { } else {