]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.11-security] net: pass if at least one matching entry in TestLook...
authorIan Lance Taylor <iant@golang.org>
Fri, 11 Jan 2019 22:26:24 +0000 (14:26 -0800)
committerFilippo Valsorda <valsorda@google.com>
Wed, 23 Jan 2019 19:06:01 +0000 (19:06 +0000)
Fixes #29698

Change-Id: I0531c0a274b120af8871aa2f5975744ff6c912a3
Reviewed-on: https://go-review.googlesource.com/c/157638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://team-review.git.corp.google.com/c/401203
Reviewed-by: Filippo Valsorda <valsorda@google.com>
src/net/lookup_test.go

index 5c66dfa2603ad902c3b0a608277dd817a76d974f..f2adbc18c5a790efd052b56a6e637f94cba3f61e 100644 (file)
@@ -237,11 +237,16 @@ func TestLookupGmailTXT(t *testing.T) {
                if len(txts) == 0 {
                        t.Error("got no record")
                }
+               found := false
                for _, txt := range txts {
-                       if !strings.Contains(txt, tt.txt) || (!strings.HasSuffix(txt, tt.host) && !strings.HasSuffix(txt, tt.host+".")) {
-                               t.Errorf("got %s; want a record containing %s, %s", txt, tt.txt, tt.host)
+                       if strings.Contains(txt, tt.txt) && (strings.HasSuffix(txt, tt.host) || strings.HasSuffix(txt, tt.host+".")) {
+                               found = true
+                               break
                        }
                }
+               if !found {
+                       t.Errorf("got %v; want a record containing %s, %s", txts, tt.txt, tt.host)
+               }
        }
 }