Sha256: d044feb5389b7c0daed81b13dac8bd4d6c3da106db3ed3274eb8539c20045bfa

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper")

require 'treevisitor/cli/cli_tree'

class TCCliTree < Test::Unit::TestCase

  TEST_DIRECTORY = File.join( $TREEVISITOR_HOME, "test_data", "tree_visitor", "test_data" )

  def test_help_message
    out = with_stdout_captured do
      args = %w{-h}
      CliTree.new.parse_args(args)
    end
    assert_match /Usage:/, out
  end

  def test_version
    out = with_stdout_captured do
      args = %w{--version}
      CliTree.new.parse_args(args)
    end
    version = File.open( File.join($TREEVISITOR_HOME, "VERSION") ).read
    assert_match version, out
  end

  def test_directories_only
    out = with_stdout_captured do
      args = %w{-d}
      args << TEST_DIRECTORY
      CliTree.new.parse_args(args)
    end
    # puts out
    assert_equal 6, out.split("\n").length

    out = with_stdout_captured do
      args = %w{-da}
      args << TEST_DIRECTORY
      CliTree.new.parse_args(args)
    end
    #puts out
    assert_equal 7, out.split("\n").length
  end

  def test_all_files
    out = with_stdout_captured do
      args = %w{-a}
      args << TEST_DIRECTORY
      CliTree.new.parse_args(args)
    end
    # puts out
    assert_equal 11, out.split("\n").length

    out = with_stdout_captured do
      args = []
      args << TEST_DIRECTORY
      CliTree.new.parse_args(args)
    end
    # puts out
    assert_equal 9, out.split("\n").length
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gf-treevisitor-0.0.10 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.11 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.12 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.13 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.15 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.16 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.18 test/treevisitor/cli/tc_cli_tree.rb
gf-treevisitor-0.0.19 test/treevisitor/cli/tc_cli_tree.rb