mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
- 新增 CrawlerApi 结构体和相关方法,实现通用的爬虫功能 - 优化了 openai_api 和 stock_data_api 中的爬虫逻辑 - 添加了 RemoveAllBlankChar函数,用于移除字符串中的空白字符 - 更新了前端 stock组件中的警告提示
34 lines
826 B
Go
34 lines
826 B
Go
package data
|
|
|
|
import (
|
|
"go-stock/backend/logger"
|
|
"testing"
|
|
)
|
|
|
|
// TestRemoveNonPrintable tests the RemoveAllBlankChar function.
|
|
func TestRemoveNonPrintable(t *testing.T) {
|
|
//tests := []struct {
|
|
// input string
|
|
// expected string
|
|
//}{
|
|
// {"新 希 望", "新希望"},
|
|
// {"", ""},
|
|
// {"Hello, World!", "Hello, World!"},
|
|
// {"\x00\x01\x02", ""},
|
|
// {"Hello\x00World", "HelloWorld"},
|
|
// {"\x1F\x20\x7E\x7F", " \x7E"},
|
|
//}
|
|
|
|
//for _, test := range tests {
|
|
// actual := RemoveAllBlankChar(test.input)
|
|
// if actual != test.expected {
|
|
// t.Errorf("RemoveAllBlankChar(%q) = %q; expected %q", test.input, actual, test.expected)
|
|
// }
|
|
//}
|
|
txt := "新 希 望"
|
|
txt2 := RemoveAllBlankChar(txt)
|
|
logger.SugaredLogger.Infof("RemoveAllBlankChar(%s)", txt2)
|
|
logger.SugaredLogger.Infof("RemoveAllBlankChar(%s)", txt)
|
|
|
|
}
|