MCPcopy Create free account
hub / github.com/antonmedv/gitmal / TestParseFileMode

Function TestParseFileMode

pkg/git/utils_test.go:10–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestParseFileMode(t *testing.T) {
11 tests := []struct {
12 mode string
13 expected string
14 }{
15 {"100644", "rw-r--r--"},
16 {"100755", "rwxr-xr-x"},
17 {"100600", "rw-------"},
18 {"100400", "r--------"},
19 }
20
21 for _, tt := range tests {
22 t.Run(tt.mode, func(t *testing.T) {
23 result, err := git.ParseFileMode(tt.mode)
24 if err != nil {
25 t.Errorf("unexpected error: %v", err)
26 }
27 if result != tt.expected {
28 t.Errorf("got %q, want %q", result, tt.expected)
29 }
30 })
31 }
32}
33
34func TestParseFileModeInvalid(t *testing.T) {
35 tests := []string{

Callers

nothing calls this directly

Calls 2

ParseFileModeFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected