Convert tests to cross-crate, fix a RefCell bug I found in the process.