Skip to content

Commit

Permalink
testing sql functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ik5 committed Oct 31, 2018
1 parent 70f4d0c commit 45f3074
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions sql_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package gostrutils

import "testing"

func TestToSQLStringEmptyString(t *testing.T) {
str := ToSQLString("")
if str.Valid {
t.Error("str.Valid cannot be true")
}
}

func TestToSQLStringNotEmptyString(t *testing.T) {
str := ToSQLString("Hello World")
if !str.Valid {
t.Error("str.Valid cannot be false")
}
}

func TestToSQLStringNotNullableEmptyString(t *testing.T) {
str := ToSQLStringNotNullable("")

if !str.Valid {
t.Error("str.Valid cannot be false")
}
}

func TestToSQLStringNotNullableNoneEmptyString(t *testing.T) {
str := ToSQLStringNotNullable("Hello World")

if !str.Valid {
t.Error("str.Valid cannot be false")
}
}

0 comments on commit 45f3074

Please sign in to comment.