MCPcopy Index your code
hub / github.com/cheat/cheat / TestWriteableOK

Function TestWriteableOK

internal/cheatpath/writeable_test.go:9–30  ·  view source on GitHub ↗

TestWriteableOK asserts that Writeable returns the appropriate cheatpath when a writeable cheatpath exists

(t *testing.T)

Source from the content-addressed store, hash-verified

7// TestWriteableOK asserts that Writeable returns the appropriate cheatpath
8// when a writeable cheatpath exists
9func TestWriteableOK(t *testing.T) {
10
11 // initialize some cheatpaths
12 cheatpaths := []Path{
13 Path{Path: "/foo", ReadOnly: true},
14 Path{Path: "/bar", ReadOnly: false},
15 Path{Path: "/baz", ReadOnly: true},
16 }
17
18 // get the writeable cheatpath
19 got, err := Writeable(cheatpaths)
20
21 // assert that no errors were returned
22 if err != nil {
23 t.Errorf("failed to get cheatpath: %v", err)
24 }
25
26 // assert that the path is correct
27 if got.Path != "/bar" {
28 t.Errorf("incorrect cheatpath returned: got: %s", got.Path)
29 }
30}
31
32// TestWriteableOK asserts that Writeable returns an error when no writeable
33// cheatpaths exist

Callers

nothing calls this directly

Calls 1

WriteableFunction · 0.85

Tested by

no test coverage detected