File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ type Builder interface {
5
5
Part1 ()
6
6
Part2 ()
7
7
Part3 ()
8
- GetResult () string
9
8
}
10
9
11
10
type Director struct {
Original file line number Diff line number Diff line change 1
1
package builder
2
2
3
- import (
4
- "strconv"
5
- "testing"
6
- )
3
+ import "testing"
7
4
8
5
type Builder1 struct {
9
6
result string
@@ -51,16 +48,16 @@ func (b *Builder2) Part3() {
51
48
b .result += 3
52
49
}
53
50
54
- func (b * Builder2 ) GetResult () string {
55
- return strconv . Itoa ( b .result )
51
+ func (b * Builder2 ) GetResult () int {
52
+ return b .result
56
53
}
57
54
58
55
func TestBuilder2 (t * testing.T ) {
59
56
builder := & Builder2 {}
60
57
director := NewDirector (builder )
61
58
director .Construct ()
62
59
res := builder .GetResult ()
63
- if res != "6" {
64
- t .Fatalf ("Builder2 fail expect 6 acture %s " , res )
60
+ if res != 6 {
61
+ t .Fatalf ("Builder2 fail expect 6 acture %d " , res )
65
62
}
66
63
}
You can’t perform that action at this time.
0 commit comments