| // Copyright 2023 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Package testenv contains helper functions for skipping tests |
| // based on which tools are present in the environment. |
| package testenv |
| |
| import ( |
| "runtime" |
| "testing" |
| ) |
| |
| // NeedsLocalhostNet skips t if networking does not work for ports opened |
| // with "localhost". |
| func NeedsLocalhostNet(t testing.TB) { |
| switch runtime.GOOS { |
| case "js", "wasip1": |
| t.Skipf(`Listening on "localhost" fails on %s; see https://go.dev/issue/59718`, runtime.GOOS) |
| } |
| } |