Simple hosts file management in Go (golang).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
407 B

  1. package goodhosts
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestItemInSlice(t *testing.T) {
  7. item := "this"
  8. list := []string{"hello", "brah"}
  9. result := itemInSlice("goodbye", list)
  10. if result {
  11. t.Error(fmt.Sprintf("'%s' should not have been found in slice.", item))
  12. }
  13. item = "hello"
  14. result = itemInSlice(item, list)
  15. if !result {
  16. t.Error(fmt.Sprintf("'%s' should have been found in slice.", item))
  17. }
  18. }