summaryrefslogtreecommitdiff
path: root/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/main_test.go b/main_test.go
index fb0a774..84d23ba 100644
--- a/main_test.go
+++ b/main_test.go
@@ -3,6 +3,7 @@ package main
import (
"gf-lt/models"
"fmt"
+ "gf-lt/config"
"strings"
"testing"
)
@@ -25,17 +26,17 @@ func TestRemoveThinking(t *testing.T) {
},
}
for i, tc := range cases {
- t.Run(fmt.Sprintf("run_%d", i), func(t *testing.T) {
- mNum := len(tc.cb.Messages)
- removeThinking(tc.cb)
- if len(tc.cb.Messages) != mNum-int(tc.toolMsgs) {
- t.Error("failed to delete tools msg", tc.cb.Messages, cfg.ToolRole)
- }
- for _, msg := range tc.cb.Messages {
- if strings.Contains(msg.Content, "<think>") {
- t.Errorf("msg contains think tag; msg: %s\n", msg.Content)
- }
- }
- })
- }
+ t.Run(fmt.Sprintf("run_%d", i), func(t *testing.T) {
+ cfg = &config.Config{ToolRole: "tool"} // Initialize cfg.ToolRole for test
+ mNum := len(tc.cb.Messages)
+ removeThinking(tc.cb)
+ if len(tc.cb.Messages) != mNum-int(tc.toolMsgs) {
+ t.Errorf("failed to delete tools msg %v; expected %d, got %d", tc.cb.Messages, mNum-int(tc.toolMsgs), len(tc.cb.Messages))
+ }
+ for _, msg := range tc.cb.Messages {
+ if strings.Contains(msg.Content, "<think>") {
+ t.Errorf("msg contains think tag; msg: %s\n", msg.Content)
+ }
+ }
+ }) }
}