Make a proper test suite and fix some bugs that cropped up

1. The delegate function objectifies the value so that
Object.getPrototypeOf will work; however, I don't want undefined to
look like an object, so make it a special case.

2. get_table was returning the table from a supertype, which in some
cases led to methods being considered in the same role twice, and even
being selected despite not being applicable.