File: inode_test.go

package info (click to toggle)
golang-github-hanwen-go-fuse 2.1.0%2Bgit20220822.58a7e14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,292 kB
  • sloc: cpp: 78; sh: 43; makefile: 16
file content (28 lines) | stat: -rw-r--r-- 480 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package fs

import (
	"syscall"
	"testing"
)

func TestInodeIsDir(t *testing.T) {
	cases := []struct {
		mode uint32
		dir  bool
	}{
		{syscall.S_IFBLK, false},
		{syscall.S_IFCHR, false},
		{syscall.S_IFDIR, true},
		{syscall.S_IFIFO, false},
		{syscall.S_IFLNK, false},
		{syscall.S_IFREG, false},
		{syscall.S_IFSOCK, false},
	}
	var i Inode
	for _, c := range cases {
		i.stableAttr.Mode = c.mode
		if i.IsDir() != c.dir {
			t.Errorf("wrong result for case %#v", c)
		}
	}
}