From e803aa488c3a95193d3e3ae358b640c299f8f121 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 23 Nov 2026 20:36:22 +0100 Subject: License --- tests/sessions.rs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'tests/sessions.rs') diff --git a/tests/sessions.rs b/tests/sessions.rs index 4f8ebd5..e382673 100644 --- a/tests/sessions.rs +++ b/tests/sessions.rs @@ -1,3 +1,10 @@ +/* + * This file is part of agent686 + * Copyright (C) 2026 Salmonik + * SPDX-License-Identifier: GPL-3.0-or-later + * https://git.2137697.xyz/agent686 + */ + use std::fs; use std::path::PathBuf; use std::process::Command; @@ -92,7 +99,9 @@ fn a_session_cannot_be_open_twice() { let system = json!({ "role": "system", "content": "x" }); let first = Session::create_as("locked".into(), "m", &system).unwrap(); - let error = Session::open("locked").err().expect("second open must fail"); + let error = Session::open("locked") + .err() + .expect("second open must fail"); assert!(error.contains("already open"), "{error}"); drop(first); @@ -127,8 +136,10 @@ fn a_torn_utf8_line_does_not_brick_a_session() { br#"{"t":"header","session":"torn","model":"m","cwd":"/tmp","system":{"role":"system","content":"s"}} "#, ); - raw.extend_from_slice(br#"{"t":"msg","role":"user","content":"hello"} -"#); + raw.extend_from_slice( + br#"{"t":"msg","role":"user","content":"hello"} +"#, + ); // A killed write that split a multi-byte character. raw.extend_from_slice(b"{\"t\":\"msg\",\"role\":\"user\",\"content\":\"caf\xc3\"}\n"); fs::write(sessions.join("torn.jsonl"), raw).unwrap(); @@ -156,7 +167,10 @@ fn last_reply_prefers_content_and_falls_back_to_reasoning() { ) .unwrap(); session - .append(&json!({ "role": "assistant", "content": null }), Some("only thinking")) + .append( + &json!({ "role": "assistant", "content": null }), + Some("only thinking"), + ) .unwrap(); drop(session); @@ -168,7 +182,10 @@ fn last_reply_prefers_content_and_falls_back_to_reasoning() { // With no content anywhere, reasoning is the fallback. let mut session = Session::create_as("reasoning-only".into(), "m", &system).unwrap(); session - .append(&json!({ "role": "assistant", "content": null }), Some("thoughts")) + .append( + &json!({ "role": "assistant", "content": null }), + Some("thoughts"), + ) .unwrap(); drop(session); let (opened, _system, _messages) = Session::open("reasoning-only").unwrap(); -- cgit v1.2.3