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:
114
akode-rs/tui/src/wrapping_reuse_tests.rs
Normal file
114
akode-rs/tui/src/wrapping_reuse_tests.rs
Normal file
@@ -0,0 +1,114 @@
|
||||
//! Compare reused first-fit rows with the generic wrapping path, including source provenance.
|
||||
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::style::Stylize;
|
||||
|
||||
#[test]
|
||||
fn custom_word_separator_reprocesses_the_remainder() {
|
||||
let separator = WordSeparator::Custom(|text| {
|
||||
let Some(space) = text.find(' ') else {
|
||||
return Box::new(std::iter::once(Word::from(text)));
|
||||
};
|
||||
Box::new([Word::from(&text[..=space]), Word::from(&text[space + 1..])].into_iter())
|
||||
});
|
||||
let line = Line::from("one two three");
|
||||
let rows =
|
||||
word_wrap_line_with_source(&line, RtOptions::new(/*width*/ 5).word_separator(separator))
|
||||
.into_iter()
|
||||
.map(|row| (row.line, row.range))
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
rows,
|
||||
vec![
|
||||
(Line::from("one"), 0..3),
|
||||
(Line::from("two"), 4..7),
|
||||
(Line::from("three"), 8..13),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn first_fit_reuse_preserves_styled_rows_and_source_ranges() {
|
||||
// A custom first-fit function exercises the unchanged generic path without copying
|
||||
// its implementation into the test. Compare complete rows, styles and byte ranges.
|
||||
let generic_first_fit = textwrap::WrapAlgorithm::Custom(|words, widths| {
|
||||
textwrap::WrapAlgorithm::FirstFit.wrap(words, widths)
|
||||
});
|
||||
// Cover distinct split, width, indentation and separator boundaries without a random matrix.
|
||||
for (text, width, initial, subsequent, break_words, separator) in [
|
||||
("", 0, "", "", true, WordSeparator::AsciiSpace),
|
||||
(
|
||||
"hello world",
|
||||
0,
|
||||
"> ",
|
||||
" ",
|
||||
true,
|
||||
WordSeparator::AsciiSpace,
|
||||
),
|
||||
(
|
||||
"cafe\u{301} 中文 👩🏽💻 🇧🇷 ガ",
|
||||
2,
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
WordSeparator::UnicodeBreakProperties,
|
||||
),
|
||||
(
|
||||
"a-very-long-hyphenated-word",
|
||||
5,
|
||||
"界",
|
||||
"ab",
|
||||
true,
|
||||
WordSeparator::AsciiSpace,
|
||||
),
|
||||
(
|
||||
"https://example.com/a/b tail",
|
||||
17,
|
||||
"> ",
|
||||
" ",
|
||||
false,
|
||||
WordSeparator::AsciiSpace,
|
||||
),
|
||||
(
|
||||
"alpha beta\u{a0}gamma\u{200b}delta",
|
||||
5,
|
||||
"",
|
||||
" ",
|
||||
true,
|
||||
WordSeparator::UnicodeBreakProperties,
|
||||
),
|
||||
(
|
||||
"one\n two\r\nthree\tfour",
|
||||
5,
|
||||
"> ",
|
||||
" ",
|
||||
true,
|
||||
WordSeparator::AsciiSpace,
|
||||
),
|
||||
(
|
||||
"\u{1b}[31mred\u{1b}[0m tail",
|
||||
80,
|
||||
"",
|
||||
"",
|
||||
false,
|
||||
WordSeparator::AsciiSpace,
|
||||
),
|
||||
] {
|
||||
let line = Line::from(vec![text.bold(), " suffix".cyan()]).italic();
|
||||
let options = RtOptions::new(width)
|
||||
.initial_indent(Line::from(initial.red()))
|
||||
.subsequent_indent(Line::from(subsequent.green()))
|
||||
.break_words(break_words)
|
||||
.word_separator(separator);
|
||||
let actual = word_wrap_line_with_source(&line, options.clone())
|
||||
.into_iter()
|
||||
.map(|row| (row.line, row.range, row.prefix_bytes))
|
||||
.collect::<Vec<_>>();
|
||||
let expected = word_wrap_line_with_source(&line, options.wrap_algorithm(generic_first_fit))
|
||||
.into_iter()
|
||||
.map(|row| (row.line, row.range, row.prefix_bytes))
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(actual, expected, "text={text:?}, width={width}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user