Sha256: a46fb43a012810d8f32db945d0f9b714fb8f7cf5fc13522840828b68ada1e67f

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/more/command.rb
#
# Extracted Fri Feb 16 02:00:36 EST 2007
# Project.rb Test Extraction
#

require 'facets/more/command.rb'


  require 'test/unit'

  class TestCommand < Test::Unit::TestCase

    #

    class MyCmd1 < Console::Command
      def _x ; @x = true ; end
      def _y ; @y = true ; end
      def _z(n) ; @z = n ; end

      global_option :_x

      # subcommand
      def go ; $output = [@x, @y, @z, @p] ; end

      module Go
        def _p(n)
          @p = n.to_i
        end
      end
    end

    MyCmd1.execute( '-xy -z HERE go -p 1' )

    def test_001
      assert_equal( [true, true, 'HERE', 1], $output )
    end

    #

    class MyCmd2 < Console::Command
      def __here ; @here = true ; end

      # subcommand

      module Go
        def _p(n)
          @p = n.to_i
        end
      end

      def go ; $output = [@here, @p] ; end
    end

    MyCmd2.execute( '--here go -p 1' )

    def test_001
      assert_equal( [true, 1], $output )
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.8.49 test/lib/facets/more/test_command.rb