Cotton code
39 lines · 1.2 KB · RustRaw
//! The two pure helpers underneath the Codex adapter. The argv, the hooks//! override and the parsers are pinned against fixtures in `tests/adapters.rs`//! and `tests/transcripts.rs`.use super::*;#[test]fn a_toml_string_escapes_the_two_characters_a_path_can_carry() {    assert_eq!(toml_string("/usr/local/bin/host"), "\"/usr/local/bin/host\"");    assert_eq!(toml_string("a\"b"), "\"a\\\"b\"");    assert_eq!(toml_string("a\\b"), "\"a\\\\b\"");    assert_eq!(toml_string("a\nb"), "\"a\\nb\"");}#[test]fn a_reset_instant_is_now_plus_the_seconds_codex_reported() {    assert_eq!(        resets_at("2026-09-18T08:00:00Z", 3600).as_deref(),        Some("2026-09-18T09:00:00Z")    );    assert_eq!(        resets_at("2026-09-18T08:00:00Z", 0).as_deref(),        Some("2026-09-18T08:00:00Z")    );}#[test]fn an_instant_that_is_not_a_time_is_no_answer_rather_than_the_present() {    assert_eq!(resets_at("not a time", 3600), None);    assert_eq!(resets_at("", 60), None);}#[test]fn a_reset_instant_is_reported_in_utc_whatever_zone_the_host_was_told() {    assert_eq!(        resets_at("2026-09-18T13:30:00+05:30", 1800).as_deref(),        Some("2026-09-18T08:30:00Z")    );}