Package-external tests must use the vendored math/big package, not
the original one, otherwise tests may fail if there are discrepancies
in the implementation.
Change-Id: Ic5f0489aa6420ffea1f488633453f871ce1f0f66
Reviewed-on: https://go-review.googlesource.com/10380
Reviewed-by: Ian Lance Taylor <iant@golang.org>
package big_test
import (
+ "cmd/compile/internal/big"
"fmt"
"log"
- "math/big"
)
func ExampleRat_SetString() {
package big_test
import (
+ "cmd/compile/internal/big"
"fmt"
"math"
- "math/big"
)
func ExampleFloat_Add() {
cp $BIGDIR/*.go .
# Use pure Go arith ops w/o build tag.
-sed 's/^\/\/ \+build math_big_pure_go$//' arith_decl_pure.go > arith_decl.go
+sed 's|^// \+build math_big_pure_go$||' arith_decl_pure.go > arith_decl.go
rm arith_decl_pure.go
+# Import vendored math/big in external tests (e.g., floatexample_test.go).
+for f in *_test.go; do
+ sed 's|"math/big"|"cmd/compile/internal/big"|' $f > foo.go
+ mv foo.go $f
+done
+
# gofmt to clean up after sed
gofmt -w .