mod common;
use predicates::prelude::*;
use tempfile::tempdir;
#[test]
fn ts_roundtrip() {
let tmp = tempdir().expect("tempdir");
common::agent_block_cmd()
.env("AGENT_BLOCK_HOME", tmp.path())
.args(["-s", &common::fixture("ts_roundtrip.lua")])
.assert()
.success()
.stdout(
predicate::str::contains("raw_count=2")
.and(predicate::str::contains("num_value=42"))
.and(predicate::str::contains("tbl_value_x=1"))
.and(predicate::str::contains("and_filter_count=2"))
.and(predicate::str::contains("agg_count=3"))
.and(predicate::str::contains("agg_sum=6"))
.and(predicate::str::contains("agg_last=3"))
.and(predicate::str::contains("bucket_count=3"))
.and(predicate::str::contains("limited_count=2"))
.and(predicate::str::contains("offset_count=2"))
.and(predicate::str::contains("offset_first_value=2")),
);
}
#[test]
fn ts_memory() {
common::agent_block_cmd()
.env("AGENT_BLOCK_TS_PATH", ":memory:")
.args(["-s", &common::fixture("ts_memory.lua")])
.assert()
.success()
.stdout(predicate::str::contains("mem_last_value=99"));
}