Skip to content

Instantly share code, notes, and snippets.

@mottet-dev
Created July 8, 2019 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mottet-dev/8e2b66cca37d72202dc2a03d84da62c3 to your computer and use it in GitHub Desktop.
Save mottet-dev/8e2b66cca37d72202dc2a03d84da62c3 to your computer and use it in GitHub Desktop.
Go test - Not In Slice
func TestDoesSliceIncludesIntNotInSlice(t *testing.T) {
inputValue := 4
inputSlice := []int{1, 2, 3}
expectedOutput := false
got := DoesSliceIncludesInt(inputValue, inputSlice)
if got != expectedOutput {
t.Errorf("SliceIncludesInt(%d, %d) = %t; want %t", inputValue, inputSlice, got, expectedOutput)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment