|
|
|
|
@ -29,7 +29,7 @@ func TestFmt_errorReporting(t *testing.T) {
|
|
|
|
|
t.Fatalf("wrong exit code. errors: \n%s", ui.ErrorWriter.String())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expected := fmt.Sprintf("Error running fmt: stat %s: no such file or directory", dummy_file)
|
|
|
|
|
expected := "There is no configuration directory at"
|
|
|
|
|
if actual := ui.ErrorWriter.String(); !strings.Contains(actual, expected) {
|
|
|
|
|
t.Fatalf("expected:\n%s\n\nto include: %q", actual, expected)
|
|
|
|
|
}
|
|
|
|
|
@ -106,9 +106,14 @@ func TestFmt_directoryArg(t *testing.T) {
|
|
|
|
|
t.Fatalf("wrong exit code. errors: \n%s", ui.ErrorWriter.String())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expected := fmt.Sprintf("%s\n", filepath.Join(tempDir, fmtFixture.filename))
|
|
|
|
|
if actual := ui.OutputWriter.String(); actual != expected {
|
|
|
|
|
t.Fatalf("got: %q\nexpected: %q", actual, expected)
|
|
|
|
|
got, err := filepath.Abs(strings.TrimSpace(ui.OutputWriter.String()))
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
want := filepath.Join(tempDir, fmtFixture.filename)
|
|
|
|
|
|
|
|
|
|
if got != want {
|
|
|
|
|
t.Fatalf("wrong output\ngot: %s\nwant: %s", got, want)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|