meta_test.go (493B)
1 package db 2 3 import "testing" 4 5 func TestQuoteIdent(t *testing.T) { 6 tests := []struct { 7 input string 8 want string 9 }{ 10 {"crsp", `"crsp"`}, 11 {"dsf", `"dsf"`}, 12 {`my"table`, `"my""table"`}, 13 {"", `""`}, 14 {"with space", `"with space"`}, 15 {`double""quote`, `"double""""quote"`}, 16 } 17 18 for _, tt := range tests { 19 t.Run(tt.input, func(t *testing.T) { 20 got := QuoteIdent(tt.input) 21 if got != tt.want { 22 t.Errorf("QuoteIdent(%q) = %q, want %q", tt.input, got, tt.want) 23 } 24 }) 25 } 26 }