File: cmdapp-app.rb

package info (click to toggle)
gonzui 1.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,824 kB
  • ctags: 1,448
  • sloc: ruby: 9,570; sh: 5,684; ansic: 1,334; lex: 1,140; makefile: 466; perl: 205; ml: 131
file content (35 lines) | stat: -rwxr-xr-x 705 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env ruby
$LOAD_PATH.unshift("..")
require 'test/unit'
require 'gonzui'
require 'gonzui/cmdapp'
require 'test-util'
include Gonzui

class CommandLineApplicationTest < Test::Unit::TestCase
  class TestApplication < CommandLineApplication
    def parse_options
      option_table = []
      return parse_options_to_hash(option_table)
    end

    def start
      parse_options
      return @config
    end
  end


  def test_app
    app = TestApplication.new
    config = app.start
    assert(config.is_a?(Config))

    original_stdout = STDOUT.dup
    assert(STDOUT.tty?)
    app.be_quiet
    assert_equal(false, STDOUT.tty?)
    STDOUT.reopen(original_stdout)
    assert(STDOUT.tty?)
  end
end