Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | //////////////////////////////////////////////////////////////////////////////// |
||
7 | package standart |
||
8 | |||
9 | import ( |
||
10 | "io" |
||
11 | "reflect" |
||
12 | "testing" |
||
13 | ) |
||
14 | |||
15 | func TestGet(t *testing.T) { |
||
16 | tests := []struct { |
||
17 | name string |
||
18 | want io.Writer |
||
19 | }{ |
||
20 | { |
||
21 | want: &Strategy{}, |
||
22 | }, |
||
23 | } |
||
24 | for _, tt := range tests { |
||
25 | t.Run(tt.name, func(t *testing.T) { |
||
26 | if got := Get(); reflect.TypeOf(got) != reflect.TypeOf(tt.want) { |
||
27 | t.Errorf("Get() = %v, want %v", got, tt.want) |
||
28 | } |
||
29 | }) |
||
30 | } |
||
31 | } |
||
32 | |||
33 | func TestWrite(t *testing.T) { |
||
34 | type args struct { |
||
35 | p []byte |
||
36 | } |
||
37 | tests := []struct { |
||
38 | name string |
||
39 | args args |
||
40 | strategy Strategy |
||
41 | wantErr bool |
||
42 | }{ |
||
43 | { |
||
44 | args: args{ |
||
45 | []byte("Hello, Alog!"), |
||
46 | }, |
||
47 | strategy: Strategy{}, |
||
48 | wantErr: false, |
||
49 | }, |
||
50 | } |
||
51 | for _, tt := range tests { |
||
52 | t.Run(tt.name, func(t *testing.T) { |
||
53 | if _, err := tt.strategy.Write(tt.args.p); (err != nil) != tt.wantErr { |
||
54 | t.Errorf("Write() error = %v, wantErr %v", err, tt.wantErr) |
||
55 | } |
||
59 |