Skip to content

Commit

Permalink
Add test for multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
pabateman committed Nov 6, 2024
1 parent b16cdef commit 0209303
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/lookuper/parsers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ func TestParserBasic(t *testing.T) {
require.True(t, reflect.DeepEqual(input.UnparsedNames, expected.UnparsedNames))
}

func TestParserMultipleFiles(t *testing.T) {
input := newDomainNames()
err := input.parseFile(path.Join(testDataPath, "lists/1.lst"))
require.NoError(t, err)
err = input.parseFile(path.Join(testDataPath, "lists/2.lst"))
require.NoError(t, err)

expected := newDomainNames()
expected.ParsedNames = []string{
"cloudflare.com",
"google.com",
"hashicorp.com",
"linked.in",
"releases.hashicorp.com",
"rpm.releases.hashicorp.com",
"terraform.io",
}

require.True(t, reflect.DeepEqual(input.ParsedNames, expected.ParsedNames))
require.True(t, reflect.DeepEqual(input.UnparsedNames, expected.UnparsedNames))
}

func TestParserEmpty(t *testing.T) {
input := newDomainNames()
err := input.parseFile(path.Join(testDataPath, "lists/empty.lst"))
Expand Down

0 comments on commit 0209303

Please sign in to comment.