Debian Codegraph @

test/irb/command/test_help.rb

raw symbols SCIP
1 require "tempfile"
2 require_relative "../helper"
3
4 module TestIRB
5 class HelpTest < IntegrationTestCase
6 def setup
7 super
8
9 write_rc <<~'RUBY'
10 IRB.conf[:USE_PAGER] = false
11 RUBY
12
13 write_ruby <<~'RUBY'
14 binding.irb
15 RUBY
16 end
17
18 def test_help
19 out = run_ruby_file do
20 type "help"
21 type "exit"
22 end
23
24 assert_match(/List all available commands/, out)
25 assert_match(/Start the debugger of debug\.gem/, out)
26 end
27
28 def test_command_help
29 out = run_ruby_file do
30 type "help ls"
31 type "exit"
32 end
33
34 assert_match(/Usage: ls \[obj\]/, out)
35 end
36
37 def test_command_help_not_found
38 out = run_ruby_file do
39 type "help foo"
40 type "exit"
41 end
42
43 assert_match(/Can't find command `foo`\. Please check the command name and try again\./, out)
44 end
45
46 def test_show_cmds
47 out = run_ruby_file do
48 type "help"
49 type "exit"
50 end
51
52 assert_match(/List all available commands/, out)
53 assert_match(/Start the debugger of debug\.gem/, out)
54 end
55
56 def test_help_lists_user_aliases
57 out = run_ruby_file do
58 type "help"
59 type "exit"
60 end
61
62 assert_match(/\$\s+Alias for `show_source`/, out)
63 assert_match(/@\s+Alias for `whereami`/, out)
64 end
65
66 def test_help_lists_helper_methods
67 out = run_ruby_file do
68 type "help"
69 type "exit"
70 end
71
72 assert_match(/Helper methods\s+conf\s+Returns the current IRB context/, out)
73 end
74 end
75 end