github.com/jackc/pgx/v5@v5.5.5/pgtype/qchar_test.go (about) 1 package pgtype_test 2 3 import ( 4 "context" 5 "math" 6 "testing" 7 8 "github.com/jackc/pgx/v5/pgxtest" 9 ) 10 11 func TestQcharTranscode(t *testing.T) { 12 skipCockroachDB(t, "Server does not support qchar") 13 14 var tests []pgxtest.ValueRoundTripTest 15 for i := 0; i <= math.MaxUint8; i++ { 16 tests = append(tests, pgxtest.ValueRoundTripTest{rune(i), new(rune), isExpectedEq(rune(i))}) 17 tests = append(tests, pgxtest.ValueRoundTripTest{byte(i), new(byte), isExpectedEq(byte(i))}) 18 } 19 tests = append(tests, pgxtest.ValueRoundTripTest{nil, new(*rune), isExpectedEq((*rune)(nil))}) 20 tests = append(tests, pgxtest.ValueRoundTripTest{nil, new(*byte), isExpectedEq((*byte)(nil))}) 21 22 // Can only test with known OIDs as rune and byte would be considered numbers. 23 pgxtest.RunValueRoundTripTests(context.Background(), t, defaultConnTestRunner, pgxtest.KnownOIDQueryExecModes, `"char"`, tests) 24 }