Sha256: 5bb3533525362f4f9719df0a60d2d4253aea47f93eeb88e09c76420216c6f50b
Contents?: true
Size: 1.54 KB
Versions: 8
Compression:
Stored size: 1.54 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require 'trace' require_relative 'fn_helper' class TestNext < Test::Unit::TestCase include FnTestHelper def test_next_same_level # See that we can next with parameter which is the same as 'next 1' cmds = %w(next continue) d = strarray_setup(cmds) d.start x = 5 y = 6 d.stop out = ['-- ', 'x = 5', '-- ', 'y = 6'] compare_output(out, d, cmds) # See that we can next with a computed count value cmds = ['next 5-3', 'continue'] d = strarray_setup(cmds) d.start ########### t1 ############### x = 5 y = 6 z = 7 ############################## d.stop # ({'remove': true}) out = ['-- ', 'x = 5', '-- ', 'z = 7'] compare_output(out, d, cmds) end def test_next_between_fn # Next over functions cmds = ['next 2', 'continue'] d = strarray_setup(cmds) d.start ########### t2 ############### def fact(x) return 1 if x <= 1 return fact(x-1) end x = fact(4) y = 5 ############################## d.stop # ({:remove => true}) out = ['-- ', 'def fact(x)', '-- ', 'y = 5'] compare_output(out, d, cmds) end def test_next_in_exception cmds = %w(next! continue) d = strarray_setup(cmds) d.start ########### t2 ############### begin got_boom = false x = 4/0 rescue got_boom = true end ############################## d.stop # ({:remove => true}) out = ['-- ', 'begin'] compare_output(out, d, cmds) end end
Version data entries
8 entries across 8 versions & 1 rubygems