Class: HelpTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/ihelp.rb

Instance Method Summary collapse

Instance Method Details

#no_warnObject



582
583
584
585
586
587
# File 'lib/ihelp.rb', line 582

def no_warn
  old_w = $-w
  $-w = nil
  yield
  $-w = old_w
end

#setupObject



589
590
591
592
593
594
595
596
# File 'lib/ihelp.rb', line 589

def setup
  no_warn{
    Object.const_set("ARGV", ["--readline", "--prompt-mode", "simple"])
  }
  IHelp.instance_variable_set(
    :@ri_driver,
    IHelp::IHelpDriver.new(IHelp::RI_ARGS))
end

#test_class_helpObject



610
611
612
# File 'lib/ihelp.rb', line 610

def test_class_help
  assert(String.help_yaml)
end

#test_class_inherited_method_helpObject



618
619
620
# File 'lib/ihelp.rb', line 618

def test_class_inherited_method_help
  assert(String.help_yaml(:map))
end

#test_class_method_helpObject



614
615
616
# File 'lib/ihelp.rb', line 614

def test_class_method_help
  assert(String.help_yaml(:new))
end

#test_help_yamlingsObject



636
637
638
639
640
641
# File 'lib/ihelp.rb', line 636

def test_help_yamlings
  assert("string".help_yaml(:reverse) ==
         help_yaml("String#reverse"))
  assert(String.help_yaml(:new) ==
         help_yaml("String::new"))
end

#test_inherited_method_helpObject



606
607
608
# File 'lib/ihelp.rb', line 606

def test_inherited_method_help
  assert("string".help_yaml(:map))
end

#test_method_constraintsObject



629
630
631
632
633
634
# File 'lib/ihelp.rb', line 629

def test_method_constraints
  assert((not "string".help_yaml(:new,true)))
  assert((not "string".help_yaml(:reverse,false)))
  assert((not String.help_yaml(:new,true)))
  assert((not String.help_yaml(:reverse,false)))
end

#test_method_equalitiesObject



622
623
624
625
626
627
# File 'lib/ihelp.rb', line 622

def test_method_equalities
  assert(String.help_yaml(:new) ==
         "string".help_yaml(:new))
  assert(String.help_yaml(:reverse) ==
         "string".help_yaml(:reverse))
end

#test_method_helpObject



602
603
604
# File 'lib/ihelp.rb', line 602

def test_method_help
  assert("string".help_yaml(:reverse))
end

#test_multipart_namespacesObject



643
644
645
646
647
648
649
650
# File 'lib/ihelp.rb', line 643

def test_multipart_namespaces
  assert(Test::Unit.help_yaml)
  assert(help_yaml("Test::Unit"))
  assert(Test::Unit.help_yaml("run?"))
  assert(help_yaml("Test::Unit.run?"))
  assert(help_yaml("Test::Unit::run?"))
  assert(help_yaml("Test::Unit#run?"))
end

#test_not_foundObject



652
653
654
655
# File 'lib/ihelp.rb', line 652

def test_not_found
  assert((NoHelp.help_yaml == nil))
  assert((String.help_yaml(:nonexistent) == nil))
end

#test_simple_helpObject



598
599
600
# File 'lib/ihelp.rb', line 598

def test_simple_help
  assert("string".help_yaml)
end