@@ -214,7 +214,7 @@ mod e2e_test {
214214 std:: env:: set_current_dir ( & project_root) . unwrap ( ) ;
215215 let mut session = spawn (
216216 & format ! (
217- "{} --dir crates/pluginlab/wit " ,
217+ "{} --dir crates/pluginlab" ,
218218 & build_command( & [ "plugin_ls.wasm" ] , "repl_logic_guest.wasm" )
219219 ) ,
220220 Some ( TEST_TIMEOUT ) ,
@@ -232,8 +232,57 @@ mod e2e_test {
232232 . expect ( "Didn't see REPL prompt" ) ;
233233 session. send_line ( "ls" ) . expect ( "Failed to send command" ) ;
234234 session
235- . exp_string ( "host-api.wit\r \n plugin-api.wit\r \n shared.wit\r \n " )
235+ . exp_string (
236+ "D\t src\r \n D\t tests\r \n D\t wit\r \n F\t Cargo.toml\r \n F\t README.md\r \n F\t build.rs\r \n " ,
237+ )
236238 . expect ( "Didn't get listing of current directory" ) ;
239+ session. send_line ( "ls wit" ) . expect ( "Failed to send command" ) ;
240+ session
241+ . exp_string ( "F\t wit/host-api.wit\r \n F\t wit/plugin-api.wit\r \n F\t wit/shared.wit\r \n " )
242+ . expect ( "Didn't get listing of wit directory" ) ;
243+ session
244+ . send_line ( "ls wit/host-api.wit" )
245+ . expect ( "Failed to send command" ) ;
246+ session
247+ . exp_string ( "F\t wit/host-api.wit\r \n " )
248+ . expect ( "Didn't get listing of host-api.wit" ) ;
249+ }
250+
251+ #[ test]
252+ fn test_cat_plugin ( ) {
253+ let project_root = find_project_root ( ) ;
254+ println ! ( "Setting current directory to: {:?}" , project_root) ;
255+ std:: env:: set_current_dir ( & project_root) . unwrap ( ) ;
256+ let mut session = spawn (
257+ & format ! (
258+ "{} --dir crates/pluginlab" ,
259+ & build_command( & [ "plugin_cat.wasm" ] , "repl_logic_guest.wasm" )
260+ ) ,
261+ Some ( TEST_TIMEOUT ) ,
262+ )
263+ . expect ( "Can't launch pluginlab with plugin greet" ) ;
264+
265+ session
266+ . exp_string ( "[Host] Starting REPL host..." )
267+ . expect ( "Didn't see startup message" ) ;
268+ session
269+ . exp_string ( "[Host] Loading plugin:" )
270+ . expect ( "Didn't see plugin loading message" ) ;
271+ session
272+ . exp_string ( "repl(0)>" )
273+ . expect ( "Didn't see REPL prompt" ) ;
274+ session
275+ . send_line ( "cat wit" )
276+ . expect ( "Failed to send command" ) ;
277+ session
278+ . exp_string ( "cat: wit: Is a directory" )
279+ . expect ( "Didn't get expected error output for trying to cat a directory" ) ;
280+ session
281+ . send_line ( "cat wit/host-api.wit" )
282+ . expect ( "Failed to send command" ) ;
283+ session
284+ . exp_string ( "package repl:api;" )
285+ . expect ( "Didn't get expected contents of host-api.wit" ) ;
237286 }
238287
239288 #[ test]
0 commit comments