Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1999)

Unified Diff: client/cipd/local/fs_test.go

Issue 1872363004: cipd: accept a function in EnsureFile (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/cipd/local/fs.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cipd/local/fs_test.go
diff --git a/client/cipd/local/fs_test.go b/client/cipd/local/fs_test.go
index c872681d16fe33afb0e9af8c48bd59bd7455d92b..b95881194fd5bc8d5b56424b953adbd2beef3ce0 100644
--- a/client/cipd/local/fs_test.go
+++ b/client/cipd/local/fs_test.go
@@ -122,18 +122,18 @@ func TestEnsureSymlink(t *testing.T) {
func TestEnsureFile(t *testing.T) {
Convey("EnsureFile checks root", t, func() {
fs := tempFileSystem()
- So(fs.EnsureFile(fs.join(".."), strings.NewReader("blah")), ShouldNotBeNil)
+ So(EnsureFile(fs, fs.join(".."), strings.NewReader("blah")), ShouldNotBeNil)
})
Convey("EnsureFile creates new file", t, func() {
fs := tempFileSystem()
- So(fs.EnsureFile(fs.join("name"), strings.NewReader("blah")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("name"), strings.NewReader("blah")), ShouldBeNil)
So(fs.read("name"), ShouldEqual, "blah")
})
Convey("EnsureFile builds full path", t, func() {
fs := tempFileSystem()
- So(fs.EnsureFile(fs.join("a/b/c"), strings.NewReader("blah")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("a/b/c"), strings.NewReader("blah")), ShouldBeNil)
So(fs.read("a/b/c"), ShouldEqual, "blah")
})
@@ -141,22 +141,22 @@ func TestEnsureFile(t *testing.T) {
Convey("EnsureFile replaces existing symlink", t, func() {
fs := tempFileSystem()
So(fs.EnsureSymlink(fs.join("path"), "target"), ShouldBeNil)
- So(fs.EnsureFile(fs.join("path"), strings.NewReader("blah")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("path"), strings.NewReader("blah")), ShouldBeNil)
So(fs.read("path"), ShouldEqual, "blah")
})
}
Convey("EnsureFile replaces existing file", t, func() {
fs := tempFileSystem()
- So(fs.EnsureFile(fs.join("path"), strings.NewReader("huh")), ShouldBeNil)
- So(fs.EnsureFile(fs.join("path"), strings.NewReader("blah")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("path"), strings.NewReader("huh")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("path"), strings.NewReader("blah")), ShouldBeNil)
So(fs.read("path"), ShouldEqual, "blah")
})
Convey("EnsureFile replaces existing directory", t, func() {
fs := tempFileSystem()
fs.write("a/b/c", "something")
- So(fs.EnsureFile(fs.join("a"), strings.NewReader("blah")), ShouldBeNil)
+ So(EnsureFile(fs, fs.join("a"), strings.NewReader("blah")), ShouldBeNil)
So(fs.read("a"), ShouldEqual, "blah")
})
}
« no previous file with comments | « client/cipd/local/fs.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698