aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
38
akode-rs/realtime-webrtc/src/linux_alsa_tests.rs
Normal file
38
akode-rs/realtime-webrtc/src/linux_alsa_tests.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
//! Verify fallback among installed layouts while ignoring non-directory entries.
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::plugin_directory;
|
||||
|
||||
#[test]
|
||||
fn discovers_available_layout_without_selecting_a_file() -> std::io::Result<()> {
|
||||
let root = std::env::temp_dir().join(format!(
|
||||
"codex-alsa-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
));
|
||||
std::fs::create_dir(&root)?;
|
||||
let multiarch = root.join("multiarch");
|
||||
let lib64 = root.join("lib64");
|
||||
let generic = root.join("generic");
|
||||
let candidates = [
|
||||
multiarch.to_str().unwrap(),
|
||||
lib64.to_str().unwrap(),
|
||||
generic.to_str().unwrap(),
|
||||
];
|
||||
|
||||
assert_eq!(plugin_directory(&candidates), None);
|
||||
std::fs::create_dir(&generic)?;
|
||||
assert_eq!(plugin_directory(&candidates), Some(candidates[2]));
|
||||
std::fs::write(&lib64, "not a directory")?;
|
||||
assert_eq!(plugin_directory(&candidates), Some(candidates[2]));
|
||||
std::fs::remove_file(&lib64)?;
|
||||
std::fs::create_dir(&lib64)?;
|
||||
assert_eq!(plugin_directory(&candidates), Some(candidates[1]));
|
||||
std::fs::create_dir(&multiarch)?;
|
||||
assert_eq!(plugin_directory(&candidates), Some(candidates[0]));
|
||||
std::fs::remove_dir_all(root)
|
||||
}
|
||||
Reference in New Issue
Block a user