feat(arr): probe methods for subtitle providers and engines

This commit is contained in:
Miguel Palhas
2026-08-25 05:54:19 +01:00
parent e0e7ddf6de
commit 8c5613b247
12 changed files with 480 additions and 14 deletions
+23 -1
View File
@@ -21,7 +21,7 @@ use std::{
use arr_core::Language;
use arr_subs::translate::{translate, Error};
use arr_subs::{Command, CommandConfig};
use arr_subs::{Backend as _, Command, CommandConfig};
fn cues(texts: &[&str]) -> Vec<arr_subs::Cue> {
texts
@@ -270,3 +270,25 @@ async fn an_edited_timeout_reaches_the_next_call() {
}
const DEFAULT: Duration = arr_subs::COMMAND_DEFAULT_TIMEOUT;
/// The lamp (#200) is the command starting and exiting cleanly — not what it
/// says. An empty batch goes in; only the exit status is judged.
#[tokio::test]
async fn a_probe_runs_the_template_and_wants_a_clean_exit() {
let dir = tempfile::tempdir().expect("tempdir");
let ok = stub(dir.path(), "ok.sh", "cat > /dev/null\n");
Command::new(config(&ok.display().to_string(), DEFAULT))
.expect("backend constructs")
.probe()
.await
.expect("a clean exit is a lit lamp");
let failing = stub(dir.path(), "fail.sh", "echo nope >&2\nexit 3\n");
let error = Command::new(config(&failing.display().to_string(), DEFAULT))
.expect("backend constructs")
.probe()
.await
.expect_err("non-zero exit");
assert!(matches!(error, Error::Transport { .. }), "got {error:?}");
}