File: file_disk_test.go

package info (click to toggle)
golang-github-mitchellh-go-fs 0.0~git20150611.0.a34c1b9-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 160 kB
  • ctags: 141
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 462 bytes parent folder | download | duplicates (4)
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
package fs

import (
	"os"
	"testing"
)

func TestFileDiskImplementsBlockDevice(t *testing.T) {
	var raw interface{}
	raw = new(FileDisk)
	if _, ok := raw.(BlockDevice); !ok {
		t.Fatal("FileDisk should be a BlockDevice")
	}
}

func TestFileDisk_NewDiskFile_Dir(t *testing.T) {
	f, err := os.Open(os.TempDir())
	if err != nil {
		t.Fatalf("err: %s", err)
	}
	defer f.Close()

	_, err = NewFileDisk(f)
	if err == nil {
		t.Fatal("should error if directory")
	}
}