File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# The unit test framework passes in the string being printed by the command finalization hook
66hook_output = sys .argv [1 ]
77
8- # hook_output will not be captured because there are no nested calls to onecmd_plus_hooks
8+ # Run a help command which results in 1 call to onecmd_plus_hooks
99res = app ('help' )
10+
11+ # hook_output will not be captured because there are no nested calls to onecmd_plus_hooks
1012if hook_output not in res .stdout :
1113 print ("PASSED" )
1214else :
1315 print ("FAILED" )
1416
15- # hook_output will be captured in the nested call to onecmd_plus_hooks that occurs in do_history()
17+ # Run the last command in the history
1618res = app ('history -r -1' )
19+
20+ # All output of the history command will be captured. This includes all output of the commands
21+ # started in do_history() using onecmd_plus_hooks(), including any output in those commands' hooks.
22+ # Therefore we expect the hook_output to show up this time.
1723if hook_output in res .stdout :
1824 print ("PASSED" )
1925else :
You can’t perform that action at this time.
0 commit comments