File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed
Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -471,4 +471,32 @@ mod e2e_test {
471471 . exp_string ( "man - Show the manual for a command" )
472472 . expect ( "Didn't get expected manual output" ) ;
473473 }
474+
475+ #[ test]
476+ fn test_man_echo ( ) {
477+ let project_root = find_project_root ( ) ;
478+ println ! ( "Setting current directory to: {:?}" , project_root) ;
479+ std:: env:: set_current_dir ( & project_root) . unwrap ( ) ;
480+ let mut session = spawn (
481+ & build_command ( & [ "plugin_echo.wasm" ] , "repl_logic_guest.wasm" ) ,
482+ Some ( TEST_TIMEOUT ) ,
483+ )
484+ . expect ( "Can't launch pluginlab with plugin greet" ) ;
485+
486+ session
487+ . exp_string ( "[Host] Starting REPL host..." )
488+ . expect ( "Didn't see startup message" ) ;
489+ session
490+ . exp_string ( "[Host] Loading plugin:" )
491+ . expect ( "Didn't see plugin loading message" ) ;
492+ session
493+ . exp_string ( "repl(0)>" )
494+ . expect ( "Didn't see REPL prompt" ) ;
495+ session
496+ . send_line ( "man echo" )
497+ . expect ( "Failed to send command" ) ;
498+ session
499+ . exp_string ( "echo - Echo a message (built with Rust" )
500+ . expect ( "Didn't get expected manual output" ) ;
501+ }
474502}
Original file line number Diff line number Diff line change @@ -23,8 +23,13 @@ impl ReplLogicGuest for Component {
2323 if let Some ( response) = reserved:: run ( & parsed_line. command , & parsed_line. payload ) {
2424 return transport:: ReadlineResponse :: Ready ( response) ;
2525 }
26- if let Some ( response) = reserved:: man ( & parsed_line. command ) {
27- return transport:: ReadlineResponse :: Ready ( response) ;
26+
27+ if parsed_line. command == "man"
28+ && ( parsed_line. payload . is_empty ( ) || parsed_line. payload == "man" )
29+ {
30+ if let Some ( response) = reserved:: man ( & parsed_line. command ) {
31+ return transport:: ReadlineResponse :: Ready ( response) ;
32+ }
2833 }
2934
3035 // if no reserved command was run return the parsed line to be passed to the plugin to run from the host
Original file line number Diff line number Diff line change @@ -92,3 +92,10 @@ test("man", async ({ page }) => {
9292 const stdout2 = await getLastStd ( page , "stdout" ) ;
9393 await expect ( stdout2 ) . toContainText ( "man - Show the manual for a command" ) ;
9494} ) ;
95+
96+ test ( "man echo" , async ( { page } ) => {
97+ await page . goto ( "/#repl" ) ;
98+ await fillAndSubmitCommand ( page , "man echo" ) ;
99+ const stdout = await getLastStd ( page , "stdout" ) ;
100+ await expect ( stdout ) . toContainText ( "echo - Echo a message (built with Rust" ) ;
101+ } ) ;
You can’t perform that action at this time.
0 commit comments