- Implement FromStr trait for NodeType instead of custom from_str method - Fix redundant_closure warning in server.rs:455 - Add #[allow(clippy::too_many_arguments)] for new_file_node - Fix unused variables in tests (_user_id, _conn) - Remove unused imports (NodeType, serde_json::json) - Replace len() > 0 with !is_empty() for clarity - Replace == false with negation operator - Format code with cargo fmt
41 lines
948 B
Rust
41 lines
948 B
Rust
use markbase::audio::{phrase_for_lang, voice_for_lang};
|
|
|
|
#[test]
|
|
fn test_voice_for_lang_zh_tw() {
|
|
assert_eq!(voice_for_lang("zh_TW"), "Meijia");
|
|
}
|
|
|
|
#[test]
|
|
fn test_voice_for_lang_en_us() {
|
|
assert_eq!(voice_for_lang("en_US"), "Samantha");
|
|
}
|
|
|
|
#[test]
|
|
fn test_voice_for_lang_unknown() {
|
|
assert_eq!(voice_for_lang("unknown"), "Meijia"); //默認為Meijia
|
|
}
|
|
|
|
#[test]
|
|
fn test_phrase_for_lang_zh_tw() {
|
|
assert_eq!(phrase_for_lang("zh_TW"), "語音測試一二三");
|
|
}
|
|
|
|
#[test]
|
|
fn test_phrase_for_lang_en_us() {
|
|
assert_eq!(phrase_for_lang("en_US"), "Test one two three");
|
|
}
|
|
|
|
#[cfg(target_os = "macos")]
|
|
#[test]
|
|
fn test_audio_devices_macos() {
|
|
use markbase::audio::audio_devices;
|
|
|
|
let (out, inp, co, ci) = audio_devices();
|
|
|
|
//至少應該有一些輸出裝置(即使是內建的)
|
|
assert!(!out.is_empty() || !inp.is_empty());
|
|
|
|
// current應該是有效的字符串
|
|
assert!(!co.is_empty() || !ci.is_empty());
|
|
}
|