[Lib/Tests/Misc] Improved error-handling and custom rules; extended tests.