Sha256: 68490dcf35e68d9f47d14834dc55ba7a9cfe23f9c8eba028fc835fa7c5046562

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

#! /usr/bin/env ruby
# coding: utf-8

require "test/unit"
require "filerenamer/optionparser.rb"

class TC_OptionParser < Test::Unit::TestCase
  #def setup
  # @frop00 = FileRenamerOptionParser.new
  #end

  def test_sanity_check
    frop01 = FileRenamer::OptionParser.new
    ary = %w(-y --copy)
    frop01.parse(ary)
    assert_equal( { :yes => true, :copy => true }, frop01.options)

    # このクラスではオプションの整合性チェックは行わない。
    frop01 = FileRenamer::OptionParser.new
    ary = %w(-y -n)
    frop01.parse(ary)
    assert_equal( { :yes => true, :no => true }, frop01.options)

    frop01 = FileRenamer::OptionParser.new
    ary = %w(-y -n -c -m -h -s -q)
    frop01.parse(ary)
    corrects = {
      :yes => true,
      :no => true,
      :copy => true,
      :move => true,
      :hardlink => true,
      :symlink => true,
      :quiet => true
    }
    assert_equal(corrects, frop01.options)

    frop01 = FileRenamer::OptionParser.new
    ary = %w(--yes --no --copy --move --hardlink --symlink --quiet)
    frop01.parse(ary)
    corrects = {
      :yes => true,
      :no => true,
      :copy => true,
      :move => true,
      :hardlink => true,
      :symlink => true,
      :quiet => true
    }
    assert_equal(corrects, frop01.options)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
filerenamer-0.0.10 test/test_optionparser.rb
filerenamer-0.0.9 test/test_optionparser.rb
filerenamer-0.0.8 test/test_optionparser.rb
filerenamer-0.0.7 test/test_optionparser.rb
filerenamer-0.0.6 test/test_optionparser.rb
filerenamer-0.0.5 test/test_optionparser.rb
filerenamer-0.0.4 test/test_optionparser.rb
filerenamer-0.0.3 test/test_optionparser.rb