Add some missing #[test] attributes.

Ah, this dead code lint is good stuff. :-)
Mark some test-only code as such to avoid dead code warnings.