First pass, work in progress: async-ify `lib/input.js`.

We're having a few problems with `wru`'s asynchronous test support in
`tests/input.js`, so I'm checking this in to pair up a bit with @gareth. I've
hand-verified (by writing a quick one-off async test harness) that most of the
tests are back in working order; it's just the harness that's messed-up.
Restore test cases that were accidentally omitted from the previous commit.