chore: 恢复旧布局基线(迁移改动丢失后重建,apps/packages 布局暂存)
This commit is contained in:
1 parent
a9510235bb
commit
456fa6954b
203 files changed
+18787
-48
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsQuerySQL(t *testing.T) {
|
||||
if !isQuerySQL("SELECT 1") {
|
||||
t.Fatal("select")
|
||||
}
|
||||
if isQuerySQL("DELETE FROM t") {
|
||||
t.Fatal("delete is not query")
|
||||
}
|
||||
if !isQuerySQL("-- hi\nSELECT 1") {
|
||||
t.Fatal("comment then select")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsDangerousSQL(t *testing.T) {
|
||||
if !IsDangerousSQL("DROP TABLE users") {
|
||||
t.Fatal("drop")
|
||||
}
|
||||
if !IsDangerousSQL("DELETE FROM users") {
|
||||
t.Fatal("delete no where")
|
||||
}
|
||||
if IsDangerousSQL("DELETE FROM users WHERE id=1") {
|
||||
t.Fatal("delete with where is ok")
|
||||
}
|
||||
if IsDangerousSQL("SELECT * FROM users") {
|
||||
t.Fatal("select")
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrMsgCanceled(t *testing.T) {
|
||||
if got := errMsg(context.Canceled); got != "已取消" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user