diff options
| -rw-r--r-- | brokenlinks/brokenlinks_test.go | 18 | ||||
| -rw-r--r-- | brokenlinks/options.go | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/brokenlinks/brokenlinks_test.go b/brokenlinks/brokenlinks_test.go index f52cde9..6feb1e2 100644 --- a/brokenlinks/brokenlinks_test.go +++ b/brokenlinks/brokenlinks_test.go @@ -112,7 +112,7 @@ func testInsecureServer(fshandle http.Handler) { } } -func TestBrokenlinks(t *testing.T) { +func TestScan(t *testing.T) { var testUrl = `http://` + testAddress type testCase struct { @@ -134,6 +134,18 @@ func TestBrokenlinks(t *testing.T) { }, { opts: brokenlinks.Options{ Url: testUrl, + IgnoreStatus: "abc", + }, + expError: `Scan: Options: invalid status code "abc"`, + }, { + opts: brokenlinks.Options{ + Url: testUrl, + IgnoreStatus: "50", + }, + expError: `Scan: Options: unknown status code "50"`, + }, { + opts: brokenlinks.Options{ + Url: testUrl, IgnoreStatus: `403`, Insecure: true, }, @@ -214,9 +226,9 @@ func TestBrokenlinks(t *testing.T) { } } -// Test running Brokenlinks with file PastResultFile is set. +// Test scanning with [Options.PastResultFile] is set. // The PastResultFile is modified to only report errors on "/page2". -func TestBrokenlinks_pastResult(t *testing.T) { +func TestScan_pastResult(t *testing.T) { var testUrl = `http://` + testAddress type testCase struct { diff --git a/brokenlinks/options.go b/brokenlinks/options.go index b4b1f3c..3e69daf 100644 --- a/brokenlinks/options.go +++ b/brokenlinks/options.go @@ -59,7 +59,7 @@ func (opts *Options) init() (err error) { } if code < http.StatusContinue || code > http.StatusNetworkAuthenticationRequired { - return fmt.Errorf(`%s: status code %s out of range`, logp, val) + return fmt.Errorf(`%s: unknown status code %q`, logp, val) } opts.ignoreStatus = append(opts.ignoreStatus, int(code)) } |
