LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package os_test | 5 package os_test |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 data, err := ioutil.ReadFile(fname) | 858 data, err := ioutil.ReadFile(fname) |
859 if err != nil { | 859 if err != nil { |
860 t.Fatalf("ReadFile: %v", err) | 860 t.Fatalf("ReadFile: %v", err) |
861 } | 861 } |
862 return string(data) | 862 return string(data) |
863 } | 863 } |
864 | 864 |
865 func TestAppend(t *testing.T) { | 865 func TestAppend(t *testing.T) { |
866 const f = "append.txt" | 866 const f = "append.txt" |
867 defer Remove(f) | 867 defer Remove(f) |
868 » s := writeFile(t, f, O_CREAT|O_TRUNC|O_RDWR, "new") | 868 » s := writeFile(t, f, O_CREATE|O_TRUNC|O_RDWR, "new") |
869 if s != "new" { | 869 if s != "new" { |
870 t.Fatalf("writeFile: have %q want %q", s, "new") | 870 t.Fatalf("writeFile: have %q want %q", s, "new") |
871 } | 871 } |
872 s = writeFile(t, f, O_APPEND|O_RDWR, "|append") | 872 s = writeFile(t, f, O_APPEND|O_RDWR, "|append") |
873 if s != "new|append" { | 873 if s != "new|append" { |
874 t.Fatalf("writeFile: have %q want %q", s, "new|append") | 874 t.Fatalf("writeFile: have %q want %q", s, "new|append") |
875 } | 875 } |
876 } | 876 } |
877 | 877 |
878 func TestStatDirWithTrailingSlash(t *testing.T) { | 878 func TestStatDirWithTrailingSlash(t *testing.T) { |
(...skipping 11 matching lines...) Expand all Loading... |
890 if err != nil { | 890 if err != nil { |
891 t.Fatal("stat failed:", err) | 891 t.Fatal("stat failed:", err) |
892 } | 892 } |
893 | 893 |
894 // Stat of path+"/" should succeed too. | 894 // Stat of path+"/" should succeed too. |
895 _, err = Stat(path + "/") | 895 _, err = Stat(path + "/") |
896 if err != nil { | 896 if err != nil { |
897 t.Fatal("stat failed:", err) | 897 t.Fatal("stat failed:", err) |
898 } | 898 } |
899 } | 899 } |
LEFT | RIGHT |