Update .gitignore to avoid emacs backup files.
Add QUnit for testing.
Pull out testing code.