Files
markbase/tests/audio_test.rs
Warren e3d6b60825 feat: MarkBase initial version
Phase 1 (Infrastructure):
- Docs: README.md, AGENTS.md, CHANGELOG.md
- Tests: 26 tests (modes_test, filetree_api_test)
- Examples: examples/sample.md, sample.json
- CI/CD: .gitea/workflows/test.yml, release.yml
- Runner: configuration scripts and guides

Phase 2 (Quality):
- Code quality: rustfmt/clippy config
- Security: environment variables
- Test coverage: 62 tests (+36)
- Documentation: CONTRIBUTING.md, docs/api.yaml
- Showcase: demo_features.md, developer_quickstart.md

Test coverage: 75%
Test pass rate: 100%
2026-05-16 15:37:37 +08:00

41 lines
944 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.len() > 0 || inp.len() > 0);
// current應該是有效的字符串
assert!(!co.is_empty() || !ci.is_empty());
}