-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathexecute_response_test.go
More file actions
92 lines (75 loc) · 2.43 KB
/
execute_response_test.go
File metadata and controls
92 lines (75 loc) · 2.43 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package gollem_test
import (
"testing"
"github.com/m-mizutani/gollem"
"github.com/m-mizutani/gt"
)
func TestNewExecuteResponse(t *testing.T) {
t.Run("create with single text", func(t *testing.T) {
resp := gollem.NewExecuteResponse("test response")
gt.Equal(t, []string{"test response"}, resp.Texts)
})
t.Run("create with multiple texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse("first", "second", "third")
gt.Equal(t, []string{"first", "second", "third"}, resp.Texts)
})
t.Run("create with no texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse()
gt.NotNil(t, resp.Texts)
gt.Equal(t, 0, len(resp.Texts))
})
}
func TestExecuteResponseString(t *testing.T) {
t.Run("single text", func(t *testing.T) {
resp := gollem.NewExecuteResponse("hello world")
gt.Equal(t, "hello world", resp.String())
})
t.Run("multiple texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse("hello", "world", "test")
gt.Equal(t, "hello world test", resp.String())
})
t.Run("empty texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse()
gt.Equal(t, "", resp.String())
})
t.Run("nil response", func(t *testing.T) {
var resp *gollem.ExecuteResponse
gt.Equal(t, "", resp.String())
})
}
func TestExecuteResponseIsEmpty(t *testing.T) {
t.Run("nil response", func(t *testing.T) {
var resp *gollem.ExecuteResponse
gt.True(t, resp.IsEmpty())
})
t.Run("empty texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse()
gt.True(t, resp.IsEmpty())
})
t.Run("single empty text", func(t *testing.T) {
resp := gollem.NewExecuteResponse("")
gt.True(t, resp.IsEmpty())
})
t.Run("non-empty texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse("test")
gt.False(t, resp.IsEmpty())
})
t.Run("multiple texts", func(t *testing.T) {
resp := gollem.NewExecuteResponse("first", "second")
gt.False(t, resp.IsEmpty())
})
t.Run("multiple empty strings", func(t *testing.T) {
resp := gollem.NewExecuteResponse("", "")
gt.True(t, resp.IsEmpty())
})
t.Run("mixed empty and non-empty strings", func(t *testing.T) {
resp := gollem.NewExecuteResponse("", "test", "")
gt.False(t, resp.IsEmpty())
})
t.Run("multiple empty strings with spaces", func(t *testing.T) {
resp := gollem.NewExecuteResponse("", "", "")
gt.True(t, resp.IsEmpty())
// Verify String() behavior for multiple empty strings
gt.Equal(t, " ", resp.String()) // Should be spaces, but IsEmpty should return true
})
}