github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/database/sql/driver/driver_test.go (about)

     1  // +build js
     2  
     3  package driver
     4  
     5  var valueConverterTests = []valueConverterTest{
     6  	{Bool, "true", true, ""},
     7  	{Bool, "True", true, ""},
     8  	{Bool, []byte("t"), true, ""},
     9  	{Bool, true, true, ""},
    10  	{Bool, "1", true, ""},
    11  	{Bool, 1, true, ""},
    12  	{Bool, int64(1), true, ""},
    13  	{Bool, uint16(1), true, ""},
    14  	{Bool, "false", false, ""},
    15  	{Bool, false, false, ""},
    16  	{Bool, "0", false, ""},
    17  	{Bool, 0, false, ""},
    18  	{Bool, int64(0), false, ""},
    19  	{Bool, uint16(0), false, ""},
    20  	{c: Bool, in: "foo", err: "sql/driver: couldn't convert \"foo\" into type bool"},
    21  	{c: Bool, in: 2, err: "sql/driver: couldn't convert 2 into type bool"},
    22  	{DefaultParameterConverter, now, now, ""},
    23  	{DefaultParameterConverter, (*int64)(nil), nil, ""},
    24  	{DefaultParameterConverter, &answer, answer, ""},
    25  	{DefaultParameterConverter, &now, now, ""},
    26  	//{DefaultParameterConverter, i(9), int64(9), ""}, // TODO: Fix.
    27  	{DefaultParameterConverter, f(0.1), float64(0.1), ""},
    28  	{DefaultParameterConverter, b(true), true, ""},
    29  	//{DefaultParameterConverter, bs{1}, []byte{1}, ""}, // TODO: Fix.
    30  	{DefaultParameterConverter, s("a"), "a", ""},
    31  	{DefaultParameterConverter, is{1}, nil, "unsupported type driver.is, a slice of int"},
    32  }