Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
840 B
Go
32 lines
840 B
Go
package dbsync
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeSQLiteDSN(t *testing.T) {
|
|
got := normalizeSQLiteDSN(`file:E:\data\remote.db`)
|
|
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
got = normalizeSQLiteDSN(`E:\data\remote.db`)
|
|
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
|
|
t.Fatalf("bare path got %q", got)
|
|
}
|
|
got = normalizeSQLiteDSN(`file:E:/data/remote.db?_pragma=foreign_keys(1)`)
|
|
if got != "file:E:/data/remote.db?_pragma=foreign_keys(1)&_pragma=busy_timeout(5000)" {
|
|
t.Fatalf("keep query got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestIsRetryable(t *testing.T) {
|
|
if !IsRetryable(Retryable("x")) {
|
|
t.Fatal("expected retryable")
|
|
}
|
|
if IsRetryable(fmtError("plain")) {
|
|
t.Fatal("plain should not")
|
|
}
|
|
}
|
|
|
|
type fmtError string
|
|
|
|
func (e fmtError) Error() string { return string(e) }
|