Skip to content

Commit

Permalink
Added test for DataContains function in common.go
Browse files Browse the repository at this point in the history
  • Loading branch information
shazbert authored and thrasher- committed Apr 11, 2017
1 parent 03aca79 commit 58741e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,23 @@ func TestStringContains(t *testing.T) {
}
}

func TestDataContains(t *testing.T) {
t.Parallel()
originalHaystack := []string{"hello", "world", "data", "Contains", "string"}
originalNeedle := "world"
anotherNeedle := "thing"
expectedOutput := true
expectedOutputTwo := false
actualResult := DataContains(originalHaystack, originalNeedle)
if actualResult != expectedOutput {
t.Error(fmt.Sprintf("Test failed. Expected '%t'. Actual '%t'", expectedOutput, actualResult))
}
actualResult = DataContains(originalHaystack, anotherNeedle)
if actualResult != expectedOutputTwo {
t.Error(fmt.Sprintf("Test failed. Expected '%t'. Actual '%t'", expectedOutputTwo, actualResult))
}
}

func TestJoinStrings(t *testing.T) {
t.Parallel()
originalInputOne := []string{"hello", "moto"}
Expand Down

0 comments on commit 58741e7

Please sign in to comment.