-
Notifications
You must be signed in to change notification settings - Fork 1
/
writer_test.go
50 lines (44 loc) · 985 Bytes
/
writer_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
// Copyright 2020 murosan. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gollect
import (
"testing"
)
func TestWriterProvider(t *testing.T) {
var provider writerProvider = &writerProviderImpl{}
for i, s := range []string{
"clipboard",
"CLIPBOARD",
"Clipboard",
"ClipBoard",
} {
switch v := provider.provide(s).(type) {
case *clipboardWriter:
// ok
default:
t.Errorf("at: %d, want: %s, actual: %T", i, "clipboardWriter", v)
}
}
for i, s := range []string{
"stdout",
"STDOUT",
"Stdout",
"StdOut",
} {
switch v := provider.provide(s).(type) {
case *stdoutWriter:
// ok
default:
t.Errorf("at: %d, want: %s, actual: %T", i, "stdoutWriter", v)
}
}
for i, s := range []string{"file", "abc"} {
switch v := provider.provide(s).(type) {
case *fileWriter:
// ok
default:
t.Errorf("at: %d, want: %s, actual: %T", i, "fileWriter", v)
}
}
}