MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / test_multiple_output

Function test_multiple_output

crates/cli/src/subcommands/sql.rs:461–504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459
460 #[test]
461 fn test_multiple_output() -> Result<(), anyhow::Error> {
462 let duration = Duration::from_micros(1000);
463 let schema = ProductType::from([("a", AlgebraicType::I32), ("b", AlgebraicType::I64)]);
464 let row = make_row(&[AlgebraicValue::I32(1), AlgebraicValue::I64(2)])?;
465
466 // Verify with and without stats
467 check_outputs(
468 &[
469 SqlStmtResult {
470 schema: schema.clone(),
471 rows: vec![&row],
472 total_duration_micros: 1000,
473 stats: SqlStmtStats {
474 rows_inserted: 1,
475 rows_deleted: 1,
476 rows_updated: 1,
477 },
478 },
479 SqlStmtResult {
480 schema: schema.clone(),
481 rows: vec![&row],
482 total_duration_micros: 1000,
483 stats: SqlStmtStats {
484 rows_inserted: 1,
485 rows_deleted: 1,
486 rows_updated: 1,
487 },
488 },
489 ],
490 Some(duration),
491 r#" a | b
492---+---
493 1 | 2
494(1 row) [inserted: 1, deleted: 1, updated: 1, server: 1.00ms]
495
496 a | b
497---+---
498 1 | 2
499(1 row) [inserted: 1, deleted: 1, updated: 1, server: 1.00ms]
500Roundtrip time: 1.00ms"#,
501 )?;
502
503 Ok(())
504 }
505
506 fn expect_psql_table(client: PsqlClient, ty: &ProductType, rows: Vec<ProductValue>, expected: &str) {
507 let table = build_table(client, ty, rows.into_iter().map(Ok::<_, ()>))

Callers

nothing calls this directly

Calls 6

make_rowFunction · 0.85
check_outputsFunction · 0.85
I32Class · 0.50
I64Class · 0.50
OkFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…