Commit 956af978 authored by Rob Pike's avatar Rob Pike

encoding/gob: delete out of memory test

Now that the library allows much larger data, it can kill
machines with less memory.

Fixes #28321

Change-Id: I98e1a5fdf812fd75adfb22bf01542423de405fe2
Reviewed-on: https://go-review.googlesource.com/c/143817Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
parent 553237aa
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"reflect" "reflect"
"runtime"
"strings" "strings"
"testing" "testing"
) )
...@@ -1128,24 +1127,3 @@ func TestBadData(t *testing.T) { ...@@ -1128,24 +1127,3 @@ func TestBadData(t *testing.T) {
} }
} }
} }
// TestHugeWriteFails tests that enormous messages trigger an error.
func TestHugeWriteFails(t *testing.T) {
if runtime.GOARCH == "wasm" {
t.Skip("out of memory on wasm")
}
if testing.Short() {
// Requires allocating a monster, so don't do this from all.bash.
t.Skip("skipping huge allocation in short mode")
}
huge := make([]byte, tooBig)
huge[0] = 7 // Make sure it's not all zeros.
buf := new(bytes.Buffer)
err := NewEncoder(buf).Encode(huge)
if err == nil {
t.Fatalf("expected error for huge slice")
}
if !strings.Contains(err.Error(), "message too big") {
t.Fatalf("expected 'too big' error; got %s\n", err.Error())
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment