diff options
author | Robert Griesemer <gri@golang.org> | 2009-12-15 15:40:16 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-12-15 15:40:16 -0800 |
commit | 13ac778ef2f757c7cd636b4336a2bd6c8f403b43 (patch) | |
tree | 28b6ebc4aa762e38c45f4b0b69d3aee472ed4c3c /src/pkg/os/path_test.go | |
parent | e4bd81f903362d998f7bfc02095935408aff0bc5 (diff) | |
download | golang-13ac778ef2f757c7cd636b4336a2bd6c8f403b43.tar.gz |
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
4th set of files.
R=rsc
CC=golang-dev
http://codereview.appspot.com/180049
Diffstat (limited to 'src/pkg/os/path_test.go')
-rw-r--r-- | src/pkg/os/path_test.go | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/pkg/os/path_test.go b/src/pkg/os/path_test.go index 9b01bd5b6..fcd4bac54 100644 --- a/src/pkg/os/path_test.go +++ b/src/pkg/os/path_test.go @@ -5,38 +5,38 @@ package os_test import ( - . "os"; - "testing"; + . "os" + "testing" ) func TestMkdirAll(t *testing.T) { // Create new dir, in _obj so it will get // cleaned up by make if not by us. - path := "_obj/_TestMkdirAll_/dir/./dir2"; - err := MkdirAll(path, 0777); + path := "_obj/_TestMkdirAll_/dir/./dir2" + err := MkdirAll(path, 0777) if err != nil { t.Fatalf("MkdirAll %q: %s", path, err) } // Already exists, should succeed. - err = MkdirAll(path, 0777); + err = MkdirAll(path, 0777) if err != nil { t.Fatalf("MkdirAll %q (second time): %s", path, err) } // Make file. - fpath := path + "/file"; - _, err = Open(fpath, O_WRONLY|O_CREAT, 0666); + fpath := path + "/file" + _, err = Open(fpath, O_WRONLY|O_CREAT, 0666) if err != nil { t.Fatalf("create %q: %s", fpath, err) } // Can't make directory named after file. - err = MkdirAll(fpath, 0777); + err = MkdirAll(fpath, 0777) if err == nil { t.Fatalf("MkdirAll %q: no error") } - perr, ok := err.(*PathError); + perr, ok := err.(*PathError) if !ok { t.Fatalf("MkdirAll %q returned %T, not *PathError", fpath, err) } @@ -45,12 +45,12 @@ func TestMkdirAll(t *testing.T) { } // Can't make subdirectory of file. - ffpath := fpath + "/subdir"; - err = MkdirAll(ffpath, 0777); + ffpath := fpath + "/subdir" + err = MkdirAll(ffpath, 0777) if err == nil { t.Fatalf("MkdirAll %q: no error") } - perr, ok = err.(*PathError); + perr, ok = err.(*PathError) if !ok { t.Fatalf("MkdirAll %q returned %T, not *PathError", ffpath, err) } @@ -58,24 +58,24 @@ func TestMkdirAll(t *testing.T) { t.Fatalf("MkdirAll %q returned wrong error path: %q not %q", ffpath, perr.Path, fpath) } - RemoveAll("_obj/_TestMkdirAll_"); + RemoveAll("_obj/_TestMkdirAll_") } func TestRemoveAll(t *testing.T) { // Work directory. - path := "_obj/_TestRemoveAll_"; - fpath := path + "/file"; - dpath := path + "/dir"; + path := "_obj/_TestRemoveAll_" + fpath := path + "/file" + dpath := path + "/dir" // Make directory with 1 file and remove. if err := MkdirAll(path, 0777); err != nil { t.Fatalf("MkdirAll %q: %s", path, err) } - fd, err := Open(fpath, O_WRONLY|O_CREAT, 0666); + fd, err := Open(fpath, O_WRONLY|O_CREAT, 0666) if err != nil { t.Fatalf("create %q: %s", fpath, err) } - fd.Close(); + fd.Close() if err = RemoveAll(path); err != nil { t.Fatalf("RemoveAll %q (first): %s", path, err) } @@ -87,16 +87,16 @@ func TestRemoveAll(t *testing.T) { if err = MkdirAll(dpath, 0777); err != nil { t.Fatalf("MkdirAll %q: %s", dpath, err) } - fd, err = Open(fpath, O_WRONLY|O_CREAT, 0666); + fd, err = Open(fpath, O_WRONLY|O_CREAT, 0666) if err != nil { t.Fatalf("create %q: %s", fpath, err) } - fd.Close(); - fd, err = Open(dpath+"/file", O_WRONLY|O_CREAT, 0666); + fd.Close() + fd, err = Open(dpath+"/file", O_WRONLY|O_CREAT, 0666) if err != nil { t.Fatalf("create %q: %s", fpath, err) } - fd.Close(); + fd.Close() if err = RemoveAll(path); err != nil { t.Fatalf("RemoveAll %q (second): %s", path, err) } @@ -104,30 +104,30 @@ func TestRemoveAll(t *testing.T) { t.Fatalf("Lstat %q succeeded after RemoveAll (second)", path) } - if Getuid() != 0 { // Test fails as root + if Getuid() != 0 { // Test fails as root // Make directory with file and subdirectory and trigger error. if err = MkdirAll(dpath, 0777); err != nil { t.Fatalf("MkdirAll %q: %s", dpath, err) } for _, s := range []string{fpath, dpath + "/file1", path + "/zzz"} { - fd, err = Open(s, O_WRONLY|O_CREAT, 0666); + fd, err = Open(s, O_WRONLY|O_CREAT, 0666) if err != nil { t.Fatalf("create %q: %s", s, err) } - fd.Close(); + fd.Close() } if err = Chmod(dpath, 0); err != nil { t.Fatalf("Chmod %q 0: %s", dpath, err) } if err = RemoveAll(path); err == nil { - _, err := Lstat(path); + _, err := Lstat(path) if err == nil { t.Errorf("Can lstat %q after supposed RemoveAll", path) } - t.Fatalf("RemoveAll %q succeeded with chmod 0 subdirectory", path, err); + t.Fatalf("RemoveAll %q succeeded with chmod 0 subdirectory", path, err) } - perr, ok := err.(*PathError); + perr, ok := err.(*PathError) if !ok { t.Fatalf("RemoveAll %q returned %T not *PathError", path, err) } |