Merge pull request #845 from travisturner/forgotten-error-check

forgotten error check which fooled the compiler but not guru/rename
This commit is contained in:
Travis Turner 2017-09-26 16:11:29 -05:00 committed by GitHub
commit 26532b5753

View file

@ -203,14 +203,14 @@ func TestHandleAction(t *testing.T) {
name string
value interface{}
expected uint64
err string
err string
}{
{name: "integer single-row-bool", action: pilosa.InputSingleRowBool, value: 1, err: "single-row-boolean value"},
{name: "string single-row-bool", action: pilosa.InputSingleRowBool,value: "1", err: "single-row-boolean value 1 must equate to a Bool"},
{name: "string value-to-row", action: pilosa.InputValueToRow,value: "25", err: "value-to-row value must equate to an integer"},
{name: "string mapping", action: pilosa.InputMapping,value: "test", err: "Value test does not exist in definition map"},
{name: "int mapping", action: pilosa.InputMapping,value: 25, err: "Mapping value must be a string"},
{name: "invalid action", action: "test",value: true, err: "Unrecognized Value Destination"},
{name: "string single-row-bool", action: pilosa.InputSingleRowBool, value: "1", err: "single-row-boolean value 1 must equate to a Bool"},
{name: "string value-to-row", action: pilosa.InputValueToRow, value: "25", err: "value-to-row value must equate to an integer"},
{name: "string mapping", action: pilosa.InputMapping, value: "test", err: "Value test does not exist in definition map"},
{name: "int mapping", action: pilosa.InputMapping, value: 25, err: "Mapping value must be a string"},
{name: "invalid action", action: "test", value: true, err: "Unrecognized Value Destination"},
}
for _, r := range tests {
t.Run(r.name, func(t *testing.T) {
@ -226,6 +226,9 @@ func TestHandleAction(t *testing.T) {
value = true
action.ValueDestination = pilosa.InputSingleRowBool
b, err := pilosa.HandleAction(action, value, colID, timestamp)
if err != nil {
t.Fatalf("err with HandleAction: %v", err)
}
if b != nil {
if b.ColumnID != 0 {
t.Fatalf("Unexpected ColumnID %v", b.ColumnID)
@ -248,6 +251,9 @@ func TestHandleAction(t *testing.T) {
action.ValueDestination = pilosa.InputSetTimestamp
t.Run("nil bit", func(t *testing.T) {
b, err = pilosa.HandleAction(action, value, colID, timestamp)
if err != nil {
t.Fatalf("err with HandleAction: %v", err)
}
if b != nil {
t.Fatalf("Expected nil bit is set")
}