-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions_test.go
More file actions
65 lines (62 loc) · 1.54 KB
/
options_test.go
File metadata and controls
65 lines (62 loc) · 1.54 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
package gometadata
import (
"testing"
)
// TestReadOptions exercises each ReadOption constructor, verifying that the
// option correctly mutates a readConfig.
func TestReadOptions(t *testing.T) {
t.Parallel()
t.Run("WithoutXMP", func(t *testing.T) {
t.Parallel()
var c readConfig
WithoutXMP()(&c)
if !c.lazyXMP {
t.Error("WithoutXMP: lazyXMP should be true")
}
})
t.Run("WithoutIPTC", func(t *testing.T) {
t.Parallel()
var c readConfig
WithoutIPTC()(&c)
if !c.lazyIPTC {
t.Error("WithoutIPTC: lazyIPTC should be true")
}
})
t.Run("WithoutEXIF", func(t *testing.T) {
t.Parallel()
var c readConfig
WithoutEXIF()(&c)
if !c.lazyEXIF {
t.Error("WithoutEXIF: lazyEXIF should be true")
}
})
t.Run("WithoutMakerNote", func(t *testing.T) {
t.Parallel()
var c readConfig
WithoutMakerNote()(&c)
if !c.skipMakerNote {
t.Error("WithoutMakerNote: skipMakerNote should be true")
}
})
}
// TestWriteOptions exercises PreserveUnknownSegments.
func TestWriteOptions(t *testing.T) {
t.Parallel()
t.Run("PreserveUnknownSegments_true", func(t *testing.T) {
t.Parallel()
var c writeConfig
PreserveUnknownSegments(true)(&c)
if !c.preserveUnknownSegments {
t.Error("PreserveUnknownSegments(true): field should be true")
}
})
t.Run("PreserveUnknownSegments_false", func(t *testing.T) {
t.Parallel()
var c writeConfig
c.preserveUnknownSegments = true // set first
PreserveUnknownSegments(false)(&c)
if c.preserveUnknownSegments {
t.Error("PreserveUnknownSegments(false): field should be false")
}
})
}