Improve doctest exception tracking and reporting
Fix expectation error reporting in doctests
Minor doctest source code improvement
Report compile-time doctest errors during test runtime