encoding: refactor tests

Turns out that having all tests in one directory is
inconvenient for development and confuses contributors.

Having internal packags now makes it straightforward to
reuse the testing code across packages.

Change-Id: Idb27199d46d9a8086ddfd27103757bdd3762d699
Reviewed-on: https://go-review.googlesource.com/37315
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 files changed