Skip to content

Commit

Permalink
Go fmt + NULL (\N) values in tests;
Browse files Browse the repository at this point in the history
deleted "not sure about safety ^^" comment (just a joke)
  • Loading branch information
m.gavrilenko committed Feb 14, 2021
1 parent 02ab5a4 commit fecfaea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
1 change: 0 additions & 1 deletion dataparser.go
Expand Up @@ -112,7 +112,6 @@ func (p *nullableParser) Parse(s io.RuneScanner) (driver.Value, error) {
runes := ""

iter := 0
//not sure about safety ^^
for {
r, _, err := s.ReadRune()
if err != nil {
Expand Down
44 changes: 43 additions & 1 deletion dataparser_test.go
Expand Up @@ -394,6 +394,48 @@ func TestParseDataNewNullableArray(t *testing.T) {
t.Log(losAngeles, moscow)

testCases := []*testCase{
{
name: "nullable null string",
inputtype: "Nullable(String)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null UInt64",
inputtype: "Nullable(UInt64)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null decimal",
inputtype: "Nullable(Decimal)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null datetime",
inputtype: "Nullable(DateTime)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null enum",
inputtype: "Nullable(Enum8('hello' = 1, 'world' = 2))",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null uuid",
inputtype: "Nullable(UUID)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable null Date",
inputtype: "Nullable(Date)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable(decimal)",
inputtype: "Nullable(Decimal(9,4))",
Expand Down Expand Up @@ -574,7 +616,7 @@ func TestParseDataNewNullableArray(t *testing.T) {
name: "malformed array(nullable(date))",
inputtype: "Array(Nullable(Date))",
inputdata: "['a000-00-00 00:00:00']",
output: []time.Time{{},},
output: []time.Time{{}},
failParseData: true,
},
{
Expand Down

0 comments on commit fecfaea

Please sign in to comment.