mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-22 17:00:21 +08:00
- 后端新增 IRIS 连接、查询、DDL、索引元数据和 DataGrid 编辑能力 - 接入 optional driver-agent、构建标签、revision 生成和变更检测流程 - 前端新增 IRIS 连接入口、方言映射、能力配置和图标展示 - 修复 IRIS 主键识别、事务开启错误处理和驱动连接关闭问题 - 补充后端、前端和构建脚本相关回归测试 Refs #408
55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package db
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"GoNavi-Wails/internal/connection"
|
|
)
|
|
|
|
func TestCustomDBConnectReportsUnsupportedODBCDriverName(t *testing.T) {
|
|
db := &CustomDB{}
|
|
|
|
err := db.Connect(connection.ConnectionConfig{
|
|
Driver: "InterSystems IRIS ODBC35",
|
|
DSN: "Driver={InterSystems IRIS ODBC35};Server=127.0.0.1;Port=1972;Database=USER;",
|
|
})
|
|
if err == nil {
|
|
t.Fatal("expected unsupported ODBC driver error, got nil")
|
|
}
|
|
|
|
message := err.Error()
|
|
for _, want := range []string{
|
|
"ODBC/JDBC",
|
|
"Go database/sql",
|
|
"暂不支持",
|
|
"InterSystems IRIS",
|
|
} {
|
|
if !strings.Contains(message, want) {
|
|
t.Fatalf("expected error to contain %q, got %q", want, message)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCustomDBConnectReportsUnregisteredGoDriver(t *testing.T) {
|
|
db := &CustomDB{}
|
|
|
|
err := db.Connect(connection.ConnectionConfig{
|
|
Driver: "not-a-registered-go-driver",
|
|
DSN: "demo",
|
|
})
|
|
if err == nil {
|
|
t.Fatal("expected unregistered Go driver error, got nil")
|
|
}
|
|
|
|
message := err.Error()
|
|
for _, want := range []string{
|
|
"未在 GoNavi 中注册",
|
|
"Go database/sql",
|
|
} {
|
|
if !strings.Contains(message, want) {
|
|
t.Fatalf("expected error to contain %q, got %q", want, message)
|
|
}
|
|
}
|
|
}
|