gc: five bug fixes, one better error.
* check for struct literal assignment to private fields.
* record, fix crash involving parallel map assignment.
* avoid infinite recursion in exportassignok.
* make floating point bounds check precise.
* avoid crash on invalid receiver.
* add context to error about implicit assignment.
Fixes #86.
Fixes #88.
Fixes #158.
Fixes #174.
Fixes #201.
Fixes #204.
R=ken2
https://golang.org/cl/154144
diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go
index 8b4299e..0999228 100644
--- a/src/pkg/math/all_test.go
+++ b/src/pkg/math/all_test.go
@@ -5,6 +5,7 @@
package math_test
import (
+ "fmt";
. "math";
"testing";
)
@@ -272,3 +273,29 @@
}
}
}
+
+// Check that math constants are accepted by compiler
+// and have right value (assumes strconv.Atof works).
+// http://code.google.com/p/go/issues/detail?id=201
+
+type floatTest struct {
+ val interface{};
+ name string;
+ str string;
+}
+
+var floatTests = []floatTest{
+ floatTest{float64(MaxFloat64), "MaxFloat64", "1.7976931348623157e+308"},
+ floatTest{float64(MinFloat64), "MinFloat64", "5e-324"},
+ floatTest{float32(MaxFloat32), "MaxFloat32", "3.4028235e+38"},
+ floatTest{float32(MinFloat32), "MinFloat32", "1e-45"},
+}
+
+func TestFloatMinMax(t *testing.T) {
+ for _, tt := range floatTests {
+ s := fmt.Sprint(tt.val);
+ if s != tt.str {
+ t.Errorf("Sprint(%v) = %s, want %s", tt.name, s, tt.str)
+ }
+ }
+}