Class: HelpTest

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

Instance Method Summary collapse

Instance Method Details

#no_warnObject



989
990
991
992
993
994
# File 'lib/ihelp.rb', line 989

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

#setupObject



996
997
998
999
1000
1001
1002
1003
# File 'lib/ihelp.rb', line 996

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



1017
1018
1019
# File 'lib/ihelp.rb', line 1017

def test_class_help
  assert(String.help_yaml)
end

#test_class_inherited_method_helpObject



1025
1026
1027
# File 'lib/ihelp.rb', line 1025

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

#test_class_method_helpObject



1021
1022
1023
# File 'lib/ihelp.rb', line 1021

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

#test_help_yamlingsObject



1043
1044
1045
1046
1047
1048
# File 'lib/ihelp.rb', line 1043

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



1013
1014
1015
# File 'lib/ihelp.rb', line 1013

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

#test_method_constraintsObject



1036
1037
1038
1039
1040
1041
# File 'lib/ihelp.rb', line 1036

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



1029
1030
1031
1032
1033
1034
# File 'lib/ihelp.rb', line 1029

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



1009
1010
1011
# File 'lib/ihelp.rb', line 1009

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

#test_multipart_namespacesObject



1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/ihelp.rb', line 1050

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



1059
1060
1061
1062
# File 'lib/ihelp.rb', line 1059

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

#test_simple_helpObject



1005
1006
1007
# File 'lib/ihelp.rb', line 1005

def test_simple_help
  assert("string".help_yaml)
end