This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bisect(start_num, end_num, test_proc) | |
# calling test_proc(start_num, end_num) should raise an exception on failure | |
legit_exceptions = [SystemExit, NoMethodError] | |
initial_fail = nil | |
begin | |
test_proc.call(start_num, end_num) | |
rescue Exception => e | |
e.reraise if legit_exceptions.include?(e.class) | |
initial_fail = true |