more sophisticated option handling for test command