core: introduce _normalizeSource and _catchEarlyExit.
tests: consolidate some tests.