Added constructor test for self-dependencies.

Made the error more clear when a self-dependency is detected
Added testsuite tests for self-dependencies