Class: HelpTest

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

Instance Method Summary collapse

Instance Method Details

#no_warnObject



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

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

#setupObject



1009
1010
1011
1012
1013
1014
1015
1016
# File 'lib/ihelp.rb', line 1009

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

#test_class_helpObject



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

def test_class_help
  assert(String.help_yaml)
end

#test_class_inherited_method_helpObject



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

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

#test_class_method_helpObject



1034
1035
1036
# File 'lib/ihelp.rb', line 1034

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

#test_help_yamlingsObject



1056
1057
1058
1059
1060
1061
# File 'lib/ihelp.rb', line 1056

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



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

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

#test_method_constraintsObject



1049
1050
1051
1052
1053
1054
# File 'lib/ihelp.rb', line 1049

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



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

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



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

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

#test_multipart_namespacesObject



1063
1064
1065
1066
1067
1068
1069
1070
# File 'lib/ihelp.rb', line 1063

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



1072
1073
1074
1075
# File 'lib/ihelp.rb', line 1072

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

#test_simple_helpObject



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

def test_simple_help
  assert("string".help_yaml)
end