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

Function check_output

crates/cli/src/subcommands/sql.rs:318–340  ·  view source on GitHub ↗
(
        schema: ProductType,
        rows: Vec<&RawValue>,
        stats: SqlStmtStats,
        duration: Option<Duration>,
        expect: &str,
    )

Source from the content-addressed store, hash-verified

316 }
317
318 fn check_output(
319 schema: ProductType,
320 rows: Vec<&RawValue>,
321 stats: SqlStmtStats,
322 duration: Option<Duration>,
323 expect: &str,
324 ) -> Result<String, anyhow::Error> {
325 let table = SqlStmtResult {
326 schema: schema.clone(),
327 rows,
328 total_duration_micros: 1000,
329 stats: stats.clone(),
330 };
331
332 let mut out = String::new();
333 print_stmt_result(&[table], duration, &mut out)?;
334
335 // Need to trim the output to because rustfmt remove the `expect` spaces
336 let out = out.lines().map(|line| line.trim_end()).join("\n");
337 assert_eq!(out, expect,);
338
339 Ok(out)
340 }
341
342 #[test]
343 fn test_output() -> Result<(), anyhow::Error> {

Callers 1

test_outputFunction · 0.85

Calls 6

print_stmt_resultFunction · 0.85
joinMethod · 0.80
newFunction · 0.50
OkFunction · 0.50
cloneMethod · 0.45
mapMethod · 0.45

Tested by 1

test_outputFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…