use super::super::{dialect_decline, provider_rows};
use super::LIVE_LISTING;
#[test]
fn the_tool_capability_is_read_off_brazens_own_column() {
let rows = provider_rows(LIVE_LISTING);
assert_eq!(rows[2].protocol, "claude_code");
assert_eq!(rows[2].tools, Some(false));
let why = rows[2].tools_blocked().expect("claude_code declines tools");
assert!(why.starts_with("claude_code declares no tools"), "{why}");
assert!(why.contains("`clients` tool"), "{why}");
assert!(why.contains("can serve no role"), "{why}");
for i in [0, 1, 3, 4] {
assert_eq!(rows[i].tools_blocked(), None, "row {i} carries tools");
}
}
#[test]
fn an_absent_tools_column_answers_nothing() {
let rows = provider_rows(
r#"{"providers":[{"name":"x","protocol":"mystery_wire","auth":"none"},
{"name":"y","protocol":"claude_code","auth":"none"}]}"#,
);
assert_eq!(rows[0].tools, None);
assert_eq!(rows[0].tools_blocked(), None);
assert_eq!(
rows[1].tools_blocked(),
None,
"a dialect this build knows is still not judged by this build"
);
}
#[test]
fn an_unknown_dialect_is_judged_by_the_column() {
let rows = provider_rows(
r#"{"providers":[{"name":"x","protocol":"mystery_wire","auth":"none","tools":false},
{"name":"y","protocol":"other_wire","auth":"none","tools":true}]}"#,
);
let why = rows[0].tools_blocked().expect("the column declined");
assert!(why.starts_with("mystery_wire declares no tools"), "{why}");
assert_eq!(rows[1].tools_blocked(), None);
}
#[test]
fn a_dead_steps_words_route_back_to_the_same_column() {
let rows = provider_rows(LIVE_LISTING);
let line = "provider error (ParseInput) on provider row \"claude-code\": \
claude_code carries no tool declarations; use the `anthropic` row for tools";
let why = dialect_decline(line, &rows).expect("the decline names its dialect");
assert_eq!(why, rows[2].tools_blocked().expect("the same sentence"));
}
#[test]
fn a_row_name_and_a_capable_dialect_route_nowhere() {
let rows = provider_rows(LIVE_LISTING);
assert_eq!(
dialect_decline("unknown provider `claude-code`", &rows),
None
);
assert_eq!(
dialect_decline("anthropic_messages requires max_tokens", &rows),
None
);
}
#[test]
fn an_empty_table_routes_nothing() {
assert_eq!(
dialect_decline("claude_code carries no tool declarations", &[]),
None
);
}