package postgres import ( "fmt" "github.com/stretchr/testify/assert" "testing" ) func TestTSQueryFromSearch(t *testing.T) { rows := [][2]string{ {`asari matron`, `asari & matron`}, {`"asari matron"`, `(asari<->matron)`}, {`"asari matron" blue`, `(asari<->matron) & blue`}, {`"christmas present" "wrapping paper"`, `(christmas<->present) & (wrapping<->paper)`}, {`stuff`, `stuff`}, } for i, row := range rows { t.Run(fmt.Sprintf("Row_%d", i), func(t *testing.T) { assert.Equal(t, row[1], TSQueryFromSearch(row[0])) }) } }