Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
99
akode-rs/tui/src/clock_format_tests.rs
Normal file
99
akode-rs/tui/src/clock_format_tests.rs
Normal file
@@ -0,0 +1,99 @@
|
||||
//! Preference precedence and native pattern parsing without changing host settings.
|
||||
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn time_locale_uses_first_nonempty_setting() {
|
||||
for (values, expected) in [
|
||||
(
|
||||
[Some("C"), Some("en_US.UTF-8"), Some("de_DE.UTF-8")],
|
||||
Some("C"),
|
||||
),
|
||||
(
|
||||
[Some(""), Some("C.UTF-8"), Some("en_US.UTF-8")],
|
||||
Some("C.UTF-8"),
|
||||
),
|
||||
([None, Some(""), Some("C.utf8")], Some("C.utf8")),
|
||||
([Some("invalid"), Some("C"), None], Some("invalid")),
|
||||
([None, Some(""), None], None),
|
||||
] {
|
||||
let environment = ["LC_ALL", "LC_TIME", "LANG"].into_iter().zip(values);
|
||||
assert_eq!(
|
||||
time_locale(|name| environment
|
||||
.clone()
|
||||
.find(|(key, _)| *key == name)
|
||||
.unwrap()
|
||||
.1
|
||||
.map(Into::into)),
|
||||
expected.map(std::ffi::OsString::from),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn standard_locales_and_unavailable_locales() {
|
||||
for locale in ["C", "POSIX", "C.UTF-8", "C.utf8"] {
|
||||
assert_eq!(
|
||||
detect_time_locale(locale),
|
||||
Some(ClockFormat::TwentyFourHour)
|
||||
);
|
||||
}
|
||||
for locale in [
|
||||
"codex_missing_locale",
|
||||
"C.codex_missing_encoding",
|
||||
"invalid\0locale",
|
||||
] {
|
||||
assert_eq!(detect_time_locale(locale), None);
|
||||
}
|
||||
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
|
||||
assert_eq!(detect_time_locale("de_DE.UTF-8"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strftime_hour_fields_determine_the_clock() {
|
||||
for (pattern, expected) in [
|
||||
("%I:%M:%S %p", Some(ClockFormat::TwelveHour)),
|
||||
("%l:%M %P", Some(ClockFormat::TwelveHour)),
|
||||
("%r", Some(ClockFormat::TwelveHour)),
|
||||
("%H:%M:%S", Some(ClockFormat::TwentyFourHour)),
|
||||
("%k:%M", Some(ClockFormat::TwentyFourHour)),
|
||||
("%R", Some(ClockFormat::TwentyFourHour)),
|
||||
("%T %Z", Some(ClockFormat::TwentyFourHour)),
|
||||
("%%I %_2OH:%M", Some(ClockFormat::TwentyFourHour)),
|
||||
("%%H %-I:%M", Some(ClockFormat::TwelveHour)),
|
||||
("%H %I", None),
|
||||
("%H %X", None),
|
||||
("%H %", None),
|
||||
("%H %Q", None),
|
||||
("%p", None),
|
||||
("%%H", None),
|
||||
("", None),
|
||||
] {
|
||||
assert_eq!(parse_strftime(pattern.as_bytes()), expected, "{pattern}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_patterns_ignore_literals_and_use_the_first_alternative() {
|
||||
for (pattern, symbols, expected) in [
|
||||
("h:mm tt", "hH", Some(ClockFormat::TwelveHour)),
|
||||
("HH:mm", "hH", Some(ClockFormat::TwentyFourHour)),
|
||||
("h 'H; o''clock' a", "hHKk", Some(ClockFormat::TwelveHour)),
|
||||
("'h' HH:mm;h:mm tt", "hH", Some(ClockFormat::TwentyFourHour)),
|
||||
("h:mm tt;HH:mm", "hH", Some(ClockFormat::TwelveHour)),
|
||||
("K a", "hHKk", Some(ClockFormat::TwelveHour)),
|
||||
("kk", "hHKk", Some(ClockFormat::TwentyFourHour)),
|
||||
("K HH:mm", "hH", Some(ClockFormat::TwentyFourHour)),
|
||||
("h 'unterminated", "hH", None),
|
||||
("h HH", "hH", None),
|
||||
("'HH' mm", "hH", None),
|
||||
("", "hH", None),
|
||||
] {
|
||||
assert_eq!(
|
||||
parse_native_pattern(pattern, symbols),
|
||||
expected,
|
||||
"{pattern}"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user