Sha256: cb77ff9647039dbbd0133d58747c2d0d19b7e1a9ad961e22d56666cb3eaba361

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
require_relative 'cmd-helper'
require_relative '../../processor/command/step'

class TestCommandStep < Test::Unit::TestCase

  include UnitHelper
  def setup
    common_setup
    @name     = File.basename(__FILE__, '.rb').split(/-/)[2]
    @my_cmd   = @cmds[@name]
  end

  def reset_cmdproc_vars
    @cmdproc.instance_variable_set('@msgs', [])
    @cmdproc.instance_variable_set('@errmsgs', [])
    @cmdproc.leave_cmd_loop = false
  end
  
  def test_step_command
    @my_cmd.run([@name, 'foo'])
    assert_equal(false,  @cmdproc.leave_cmd_loop)

    reset_cmdproc_vars
    @my_cmd.run([@name, '5'])
    assert_equal(true,  @cmdproc.leave_cmd_loop)
    assert_equal(4,  @core.step_count)

    reset_cmdproc_vars
    @my_cmd.run([@name])
    assert_equal(true,  @cmdproc.leave_cmd_loop)
    assert_equal(0,  @core.step_count)

    reset_cmdproc_vars
    @my_cmd.run([@name, '1+(2*3)'])
    assert_equal(true,  @cmdproc.leave_cmd_loop)
    assert_equal(6,  @core.step_count)

    reset_cmdproc_vars
    @my_cmd.run([@name, '1+foo'])
    assert_equal(false,  @cmdproc.leave_cmd_loop)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
trepanning-2.15.35 test/unit/test-cmd-step.rb
trepanning-1.93.35 test/unit/test-cmd-step.rb
trepanning-2.15.33 test/unit/test-cmd-step.rb
trepanning-1.93.32 test/unit/test-cmd-step.rb
trepanning-0.1.6 test/unit/test-cmd-step.rb
trepanning-0.1.4 test/unit/test-cmd-step.rb
trepanning-0.1.3 test/unit/test-cmd-step.rb
trepanning-0.1.2 test/unit/test-cmd-step.rb
trepanning-0.1.1 test/unit/test-cmd-step.rb
trepanning-0.1.0 test/unit/test-cmd-step.rb