1
//! PRINT output longer than the guest's staging area reaches the host whole.
2

            
3
use super::*;
4

            
5
2
async fn output_of(source: &str) -> String {
6
2
    let mut session = Session::new(ScriptCtx::new(uuid::Uuid::nil())).expect("Session::new");
7
2
    session.handle_request(source).await.output
8
2
}
9

            
10
#[tokio::test]
11
1
async fn a_long_message_arrives_whole_and_in_order() {
12
1
    let text = format!("a{}z", "é".repeat(3000));
13
1
    let output = output_of(&format!("(print \"{text}\")")).await;
14
1
    assert!(output.contains(&text), "got {} bytes", output.len());
15
1
}
16

            
17
#[tokio::test]
18
1
async fn a_short_message_still_prints() {
19
1
    assert!(output_of("(print \"hi\")").await.contains("hi"));
20
1
}