aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cli.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-18 12:28:29 +0100
committersalmonik <salmonik@tuta.io>2026-11-18 12:28:29 +0100
commit84e70c0e73460e5db1297c47d02d9b76802bfdf7 (patch)
treeff0cd75141a28d7112b4f82b2c74bdba91b332a3 /tests/cli.rs
parent0.9.0: distinguishable tool errors, separated stderr, configurable limits (diff)
downloadagent686-84e70c0e73460e5db1297c47d02d9b76802bfdf7.tar.gz
agent686-84e70c0e73460e5db1297c47d02d9b76802bfdf7.zip
0.9.1: correctness fixes from the audit
- 64 MiB limit detected by file length, so pipelines and redirects are reported - bash temp files removed on every path via a scope guard - validate requires content/new as the schemas declare (present, may be empty) - Session::open folds in model-switch records; resume matches --list - combining mark at a wrap boundary no longer counts as a new row - --flag=value accepted; flag-shaped values rejected - dead code removed; last_reply folded into open (one read per resume)
Diffstat (limited to '')
-rw-r--r--tests/cli.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/cli.rs b/tests/cli.rs
index 6c041fb..5a4c03f 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -145,3 +145,28 @@ fn show_renders_a_transcript() {
145 assert!(stdout.contains("on it"), "{stdout}"); 145 assert!(stdout.contains("on it"), "{stdout}");
146 assert!(stdout.contains("thinking about it"), "{stdout}"); 146 assert!(stdout.contains("thinking about it"), "{stdout}");
147} 147}
148
149#[test]
150fn a_flag_shaped_value_is_rejected_unless_attached() {
151 let output = agent().args(["--session", "--list"]).output().unwrap();
152 assert_eq!(output.status.code(), Some(2));
153 assert!(
154 String::from_utf8_lossy(&output.stderr).contains("needs a value"),
155 "{:?}",
156 String::from_utf8_lossy(&output.stderr)
157 );
158
159 // The attached form works and creates a session whose id starts with `-`.
160 let home = temp_home("dash-session");
161 let output = agent()
162 .env("HOME", &home)
163 .env("OPENCODE_API_KEY", "test")
164 .args(["--session=-abc", "--base-url", "http://127.0.0.1:9/v1"])
165 .stdin(std::process::Stdio::null())
166 .output()
167 .unwrap();
168 assert_eq!(output.status.code(), Some(0), "{output:?}");
169 assert!(home
170 .join(".local/share/agent686/sessions/-abc.jsonl")
171 .exists());
172}