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.
 
 
 

23 lines
418 B

  1. package goodhosts
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestHostsLineIsComment(t *testing.T) {
  7. comment := " # This is a comment "
  8. line := NewHostsLine(comment)
  9. result := IsComment(line.Raw)
  10. if !result {
  11. t.Error(fmt.Sprintf("'%s' should be a comment", comment))
  12. }
  13. }
  14. func TestNewHostsLineWithEmptyLine(t *testing.T) {
  15. line := NewHostsLine("")
  16. if line.Raw != "" {
  17. t.Error("Failed to load empty line.")
  18. }
  19. }