From 38e66cf43ae075e5b3319e0f004f1cbf129ade8a Mon Sep 17 00:00:00 2001 From: xenolf Date: Fri, 30 Oct 2015 13:50:02 +0100 Subject: [PATCH] Fix test regexp --- acme/simple_http_challenge_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/acme/simple_http_challenge_test.go b/acme/simple_http_challenge_test.go index 9989af8d..eed4d123 100644 --- a/acme/simple_http_challenge_test.go +++ b/acme/simple_http_challenge_test.go @@ -58,10 +58,11 @@ func TestSimpleHTTPConnectionRefusal(t *testing.T) { if err := solver.Solve(clientChallenge, "test.domain"); err == nil { t.Error("UNEXPECTED: Expected Solve to return an error but the error was nil.") } else { - reg := "Failed to post JWS message\\. -> Post http:\\/\\/localhost:4000: dial tcp 127\\.0\\.0\\.1:4000: (getsockopt: )?connection refused" + reg := "/Failed to post JWS message\\. -> Post http:\\/\\/localhost:4000: dial tcp 127\\.0\\.0\\.1:4000: (getsockopt: )?connection refused/g" + test2 := "Failed to post JWS message. -> Post http://localhost:4000: dial tcp 127.0.0.1:4000: connection refused" r, _ := regexp.Compile(reg) - if r.MatchString(err.Error()) { - t.Errorf("Expected error to match %s but instead got %s", reg, err.Error()) + if r.MatchString(err.Error()) && r.MatchString(test2) { + t.Errorf("Expected \"%s\" to match %s", err.Error(), reg) } } }