forked from richardlehane/msoleps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msoleps_test.go
52 lines (46 loc) · 1.29 KB
/
msoleps_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
49
50
51
52
package msoleps
import (
"os"
"testing"
)
var (
testDocSum = "test/DocumentSummaryInformation"
testSum = "test/SummaryInformation"
testSum1 = "test/SummaryInformation1"
)
func testFile(t *testing.T, path string) *Reader {
file, _ := os.Open(path)
defer file.Close()
doc, err := NewFrom(file)
if err != nil {
t.Errorf("Error opening file; Returns error: %v", err)
}
return doc
}
func TestDocSum(t *testing.T) {
doc := testFile(t, testDocSum)
if len(doc.Property) != 12 {
t.Errorf("Expecting 12 properties, got %d", len(doc.Property))
}
if doc.Property[1].String() != "Australian Broadcasting Corporation" {
t.Errorf("Expecting 'ABC' as second property, got %s", doc.Property[1])
}
}
func TestSum(t *testing.T) {
doc := testFile(t, testSum)
if len(doc.Property) != 17 {
t.Errorf("Expecting 17 properties, got %d", len(doc.Property))
}
if doc.Property[5].String() != "Normal" {
t.Errorf("Expecting 'Normal' as sixth property, got %s", doc.Property[5])
}
}
func TestSum1(t *testing.T) {
doc := testFile(t, testSum1)
if len(doc.Property) != 3 {
t.Errorf("Expecting 3 properties, got %d", len(doc.Property))
}
if doc.Property[0].String() != "Mail" {
t.Errorf("Expecting 'Mail' as first property, got %s", doc.Property[0])
}
}