#!/usr/bin/env ruby
require 'rubygems'; require 'require_relative'
require_relative './mock-helper'
require_relative './cmd-helper'
require_relative '../../processor/command/edit'

class TestCommandEdit < Test::Unit::TestCase
  include MockUnitHelper
  def setup
    @name = File.basename(__FILE__, '.rb').split(/-/)[2]
    $msgs = []
    $errmsgs = []
    common_setup(@name)
    def @cmd.msg(message)
      $msgs << message
    end
    def @cmd.errmsg(message)
      $errmsgs << message
    end
  end

  def test_basic
    old_editor = ENV['EDITOR']
    ENV['EDITOR'] = '#'
    base_file = File.basename(__FILE__)
    @cmd.proc.settings[:basename] = true
    @cmd.run([@name])
    assert_equal "Running # +7 \"mock-helper.rb\"...", $msgs[-1]
    @cmd.run([@name, 8])
    assert_equal "Running # +8 \"mock-helper.rb\"...", $msgs[-1]
    @cmd.run([@name, __FILE__])
    assert_equal "Running # +1 \"#{base_file}\"...", $msgs[-1]
  end
end

Add an "edit" command unit test.
Add an "edit" command unit test.
