1511638f5SAlex Crichton use test_programs::p3::wasi as wasip3; 2301dc716SAlex Crichton main()3511638f5SAlex Crichtonfn main() { 4301dc716SAlex Crichton match std::env::args().nth(1).as_deref() { 5511638f5SAlex Crichton Some("p2-append") => { 6511638f5SAlex Crichton let fields = wasip2::http::types::Fields::new(); 7301dc716SAlex Crichton for i in 0.. { 8301dc716SAlex Crichton if fields.append(&format!("a{i}"), b"a").is_err() { 9301dc716SAlex Crichton break; 10301dc716SAlex Crichton } 11301dc716SAlex Crichton } 12301dc716SAlex Crichton } 13511638f5SAlex Crichton Some("p2-append-empty") => { 14511638f5SAlex Crichton let fields = wasip2::http::types::Fields::new(); 15301dc716SAlex Crichton for i in 0.. { 16301dc716SAlex Crichton if fields.append(&format!("a{i}"), b"").is_err() { 17301dc716SAlex Crichton break; 18301dc716SAlex Crichton } 19301dc716SAlex Crichton } 20301dc716SAlex Crichton } 21511638f5SAlex Crichton Some("p2-append-same") => { 22511638f5SAlex Crichton let fields = wasip2::http::types::Fields::new(); 23511638f5SAlex Crichton loop { 24301dc716SAlex Crichton if fields.append("a", b"b").is_err() { 25301dc716SAlex Crichton break; 26301dc716SAlex Crichton } 27511638f5SAlex Crichton } 28511638f5SAlex Crichton } 29511638f5SAlex Crichton Some("p2-append-same-empty") => { 30511638f5SAlex Crichton let fields = wasip2::http::types::Fields::new(); 31511638f5SAlex Crichton loop { 32301dc716SAlex Crichton if fields.append("a", b"").is_err() { 33301dc716SAlex Crichton break; 34301dc716SAlex Crichton } 35511638f5SAlex Crichton } 36511638f5SAlex Crichton } 37511638f5SAlex Crichton Some("p3-append") => { 38511638f5SAlex Crichton let fields = wasip3::http::types::Fields::new(); 39511638f5SAlex Crichton for i in 0.. { 40511638f5SAlex Crichton if fields.append(&format!("a{i}"), b"a").is_err() { 41*a1a74d3aSBailey Hayes println!("error received"); 42*a1a74d3aSBailey Hayes return; 43511638f5SAlex Crichton } 44511638f5SAlex Crichton } 45511638f5SAlex Crichton } 46511638f5SAlex Crichton Some("p3-append-empty") => { 47511638f5SAlex Crichton let fields = wasip3::http::types::Fields::new(); 48511638f5SAlex Crichton for i in 0.. { 49511638f5SAlex Crichton if fields.append(&format!("a{i}"), b"").is_err() { 50*a1a74d3aSBailey Hayes println!("error received"); 51*a1a74d3aSBailey Hayes return; 52511638f5SAlex Crichton } 53511638f5SAlex Crichton } 54511638f5SAlex Crichton } 55511638f5SAlex Crichton Some("p3-append-same") => { 56511638f5SAlex Crichton let fields = wasip3::http::types::Fields::new(); 57511638f5SAlex Crichton loop { 58511638f5SAlex Crichton if fields.append("a", b"b").is_err() { 59*a1a74d3aSBailey Hayes println!("error received"); 60*a1a74d3aSBailey Hayes return; 61511638f5SAlex Crichton } 62511638f5SAlex Crichton } 63511638f5SAlex Crichton } 64511638f5SAlex Crichton Some("p3-append-same-empty") => { 65511638f5SAlex Crichton let fields = wasip3::http::types::Fields::new(); 66511638f5SAlex Crichton loop { 67511638f5SAlex Crichton if fields.append("a", b"").is_err() { 68*a1a74d3aSBailey Hayes println!("error received"); 69*a1a74d3aSBailey Hayes return; 70511638f5SAlex Crichton } 71511638f5SAlex Crichton } 72511638f5SAlex Crichton } 73301dc716SAlex Crichton other => panic!("unknown test {other:?}"), 74301dc716SAlex Crichton } 75301dc716SAlex Crichton 76*a1a74d3aSBailey Hayes // p2 cases trap before reaching here 77301dc716SAlex Crichton unreachable!(); 78301dc716SAlex Crichton } 79