test: add rotate.go and fixedbugs/bug313

Update #4139.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7094047
7 files changed