File: dirent_test.go

package info (click to toggle)
golang-github-charlievieth-fastwalk 1.0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: makefile: 80; sh: 35; asm: 13
file content (20 lines) | stat: -rw-r--r-- 478 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris

package dirent

import "testing"

func TestReadIntSize(t *testing.T) {
	if i, ok := readInt(nil, 1, 1); i != 0 || ok {
		t.Errorf("readInt(nil, 1, 1) = %d, %t; want: %d, %t", i, ok, 0, false)
	}
}

func TestReadIntInvalidSize(t *testing.T) {
	defer func() {
		if e := recover(); e == nil {
			t.Errorf("Expected panic for invalid size")
		}
	}()
	readInt(make([]byte, 32), 0, 9)
}