aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/strconv/fp_test.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/strconv/fp_test.go b/src/strconv/fp_test.go
index fd73958c97..376e8f591c 100644
--- a/src/strconv/fp_test.go
+++ b/src/strconv/fp_test.go
@@ -6,8 +6,8 @@ package strconv_test
import (
"bufio"
+ _ "embed"
"fmt"
- "os"
"strconv"
"strings"
"testing"
@@ -92,15 +92,11 @@ func myatof32(s string) (f float32, ok bool) {
return f1, true
}
-func TestFp(t *testing.T) {
- f, err := os.Open("testdata/testfp.txt")
- if err != nil {
- t.Fatal("testfp: open testdata/testfp.txt:", err)
- }
- defer f.Close()
-
- s := bufio.NewScanner(f)
+//go:embed testdata/testfp.txt
+var testfp string
+func TestFp(t *testing.T) {
+ s := bufio.NewScanner(strings.NewReader(testfp))
for lineno := 1; s.Scan(); lineno++ {
line := s.Text()
if len(line) == 0 || line[0] == '#' {