MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestGetTable

Function TestGetTable

IceFireDB-SQLite/internal/sqlite/db_test.go:12–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestGetTable(t *testing.T) {
13 sqlList := [][]string{
14 {"select * from a", "a"},
15 {"select * FROM a", "a"},
16 {"select * FROM a where 1=1", "a"},
17 {"select version()", ""},
18 {"SELECT * FROM users WHERE id = 1", "users"},
19 {"select count(*) from orders", "orders"},
20 {"FROM products select *", "products"}, // This actually extracts "products"
21 {"", ""}, // Empty SQL
22 }
23 for _, sql := range sqlList {
24 table := getTableName(sql[0])
25 if table != sql[1] {
26 t.Errorf("table name error, sql: %s, getTableName: %s, expected: %s", sql[0], table, sql[1])
27 }
28 }
29}
30
31func TestGetColumnTypeAndLen(t *testing.T) {
32 testCases := []struct {

Callers

nothing calls this directly

Calls 1

getTableNameFunction · 0.85

Tested by

no test coverage detected