Check that a cancel function exists before calling it on a promise

Fixes #151.
Merge branch 'master' into geezer

Conflicts:
	lib/Test.js