Index: src/pkg/encoding/json/decode_test.go |
=================================================================== |
--- a/src/pkg/encoding/json/decode_test.go |
+++ b/src/pkg/encoding/json/decode_test.go |
@@ -6,6 +6,7 @@ |
import ( |
"bytes" |
+ "errors" |
"fmt" |
"image" |
"reflect" |
@@ -547,6 +548,22 @@ |
} |
} |
+// issue 4222 |
+func TestDecodeErrorTypeAssertion(t *testing.T) { |
+ err := errors.New("boom") |
+ err_json, e0 := Marshal(err) |
+ if e0 != nil { |
+ t.Error(e0) |
+ } |
+ var err2 error |
+ if e1 := Unmarshal(err_json, &err2); e1 == nil { |
+ t.Errorf("expected %s, received: %v", |
+ "reflect.Set: value of type map[string]interface {} is not assignable to type error", |
+ e1, |
+ ) |
+ } |
+} |
+ |
func noSpace(c rune) rune { |
if isSpace(c) { |
return -1 |