Sha256: ed72b34dc81f6aca0b24295a718953acb42aa10ee16f9cb7aa745f8ca925355c

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 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', "#<ZeroDivisionError: divided by 0>", "!! ", "x = 4/0"]
    compare_output(out, d, cmds)
  end
end






Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trepanning-1.93.35 test/functional/test-next.rb
trepanning-1.93.32 test/functional/test-next.rb
trepanning-0.1.6 test/functional/test-next.rb
trepanning-0.1.4 test/functional/test-next.rb