Trap warnings and check their contents while testing other code.