aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/cmd/gofmt/gofmt_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/gofmt/gofmt_test.go')
-rw-r--r--libgo/go/cmd/gofmt/gofmt_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libgo/go/cmd/gofmt/gofmt_test.go b/libgo/go/cmd/gofmt/gofmt_test.go
index dea0127..b7ca9e8 100644
--- a/libgo/go/cmd/gofmt/gofmt_test.go
+++ b/libgo/go/cmd/gofmt/gofmt_test.go
@@ -171,3 +171,16 @@ func TestCRLF(t *testing.T) {
t.Errorf("%s contains CR's", golden)
}
}
+
+func TestBackupFile(t *testing.T) {
+ dir, err := ioutil.TempDir("", "gofmt_test")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(dir)
+ name, err := backupFile(filepath.Join(dir, "foo.go"), []byte(" package main"), 0644)
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Logf("Created: %s", name)
+}