MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / TestCanCacheQuery

Function TestCanCacheQuery

utils_test.go:51–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestCanCacheQuery(t *testing.T) {
52 testCanCacheQuery(t, "", false)
53 testCanCacheQuery(t, " ", false)
54 testCanCacheQuery(t, "INSERT aaa", false)
55 testCanCacheQuery(t, "\t INSERT aaa ", false)
56 testCanCacheQuery(t, "select", true)
57 testCanCacheQuery(t, "\t\t SELECT 123 ", true)
58 testCanCacheQuery(t, "\t\t sElECt 123 ", true)
59 testCanCacheQuery(t, " --- sd s\n /* dfsf */\n seleCT ", true)
60 testCanCacheQuery(t, " --- sd s\n /* dfsf */\n insert ", false)
61 testCanCacheQuery(t, "WITH 1 as alias SELECT alias FROM nothing ", true)
62}
63
64func testCanCacheQuery(t *testing.T, q string, expected bool) {
65 t.Helper()

Callers

nothing calls this directly

Calls 1

testCanCacheQueryFunction · 0.85

Tested by

no test coverage detected