Permalink
Browse files

More docs

  • Loading branch information...
1 parent 3b8c44e commit beddaa442406ca2cefa79e7728803778d102372e @paulhammond committed Mar 1, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 fakefs.go
View
@@ -11,7 +11,7 @@
// testFS := fakehttpfs.FileSystem(
// fakehttpfs.File("/robots.txt", "User-agent: *\nDisallow: /"),
// fakehttpfs.Dir("/misc",
-// fakehttpfs.File("hello.txt", "Hello")
+// fakehttpfs.File("hello.txt", "Hello", os.FileMode(0600))
// os.Open("/path/to/some/real/file.txt")
// )
// );
@@ -46,7 +46,10 @@ func FileSystem(files ...http.File) http.FileSystem {
return &dir{"", files, 0}
}
-// a test fake file with string contents.
+// Creates a test fake file with string contents. If options includes a
+// time.Time it is used to specify the file modification time, if not the zero
+// time is used. Likewise, if options includes an os.FileMode it is used to
+// specify the file mode, if not 0644 is used.
func File(name, contents string, options ...interface{}) http.File {
b := []byte(contents)
f := file{name: name, mode: 0644, size: int64(len(b)), Reader: bytes.NewReader(b)}

0 comments on commit beddaa4

Please sign in to comment.