MCPcopy Create free account
hub / github.com/go-git/go-billy / TestWriteFile

Method TestWriteFile

test/basic.go:552–564  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

550}
551
552func (s *BasicSuite) TestWriteFile(c *C) {
553 err := util.WriteFile(s.FS, "foo", []byte("bar"), 0777)
554 c.Assert(err, IsNil)
555
556 f, err := s.FS.Open("foo")
557 c.Assert(err, IsNil)
558
559 wrote, err := ioutil.ReadAll(f)
560 c.Assert(err, IsNil)
561 c.Assert(string(wrote), DeepEquals, "bar")
562
563 c.Assert(f.Close(), IsNil)
564}
565
566func (s *BasicSuite) TestTruncate(c *C) {
567 f, err := s.FS.Create("foo")

Callers

nothing calls this directly

Calls 3

WriteFileFunction · 0.92
OpenMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected