-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelement_test.go
48 lines (38 loc) · 896 Bytes
/
element_test.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package poller
import (
"testing"
"time"
)
type testElement struct {
name string
lastModified time.Time
isDirectory bool
}
func (te *testElement) Name() string {
return te.name
}
func (te *testElement) LastModified() time.Time {
return te.lastModified
}
func (te *testElement) IsDirectory() bool {
return te.isDirectory
}
func TestElement_Name(t *testing.T) {
e := testElement{name: "e"}
if actual := e.name; "e" != actual {
t.Errorf("Expected e and got %s", actual)
}
}
func TestElement_LastModified(t *testing.T) {
var date time.Time
e := testElement{lastModified: date}
if actual := e.lastModified; date != actual {
t.Errorf("Expected 0001-01-01 00:00:00 +0000 UTC and got %s", actual)
}
}
func TestElement_IsDirectory(t *testing.T) {
e := testElement{}
if actual := e.isDirectory; false != actual {
t.Errorf("Expected false and got %t", actual)
}
}