move simple parse test to parse_test.go which apply only to the parser. tests in dowcrawler_test.go remain integration/functional tests.

This commit is contained in:
swaits committed 2015-02-15 07:45:06 -08:00
1 parent 0cd3cb510a
commit 042812f38e
2 files changed
+30 -25

No files matched your search

-25
View File
@@ -70,28 +70,3 @@ func TestSimpleFetch(t *testing.T) {
t.Error("fetch succeeded, but content mismatched")
}
}
// TestSimpleParse verifies that we can extract URLs (etc.) from a known document
func TestSimpleParse(t *testing.T) {
doc := `<html>
<head>
</head>
<body>
<img src="/assets/image.png"/>
<a href="/about.html">
</body>
</html>`
matches, err := parse(doc)
if err != nil {
t.Error(err)
}
if len(matches) != 2 {
t.Error("invalid number of matches in parse")
}
if matches[0] != "/about.html" {
t.Error("match text is invalid")
}
if matches[1] != "/assets/image.png" {
t.Error("match text is invalid")
}
}
+30
View File
@@ -0,0 +1,30 @@
package main
import (
"testing"
)
// TestSimpleParse verifies that we can extract URLs (etc.) from a known document
func TestSimpleParse(t *testing.T) {
doc := `<html>
<head>
</head>
<body>
<img src="/assets/image.png"/>
<a href="/about.html">
</body>
</html>`
matches, err := parse(doc)
if err != nil {
t.Error(err)
}
if len(matches) != 2 {
t.Error("invalid number of matches in parse")
}
if matches[0] != "/about.html" {
t.Error("match text is invalid")
}
if matches[1] != "/assets/image.png" {
t.Error("match text is invalid")
}
}