Skip to content

Commit

Permalink
Issue #10: add test for domains with underscores.
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenBlack committed May 20, 2020
1 parent d3d6178 commit fc9badd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,17 @@ func TestMash(t *testing.T) {
fmt.Println(hf.Domains)
}
}

func TestUnderscores(t *testing.T) {
// testing for splitting multiple Domains per line into individual lines
hf := Hosts{}
hf.Load("./test/hosts-underscores")

got := len(hf.Domains)
want := 2

if got != want {
t.Errorf("got %d domain, want %d", got, want)
fmt.Println(hf.Domains)
}
}
2 changes: 2 additions & 0 deletions test/hosts-underscores
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
127.0.0.0 is_this_the_real_life.com
127.0.0.0 or_is_this_just_fantasy.org

0 comments on commit fc9badd

Please sign in to comment.