1 parent
7493de6952
commit
3078ba5705
45 files changed
+2139
-1880
No files matched your search
@@ -167,11 +167,11 @@ async fn read_file(sandbox: &Sandbox, args: &Value) -> anyhow::Result<String> {
|
||||
Ok(number_lines(&into_stdout(output)?, first_line))
|
||||
}
|
||||
|
||||
/// Préfixe chaque ligne par son numéro.
|
||||
/// Prefixes each line with its number.
|
||||
///
|
||||
/// Le modèle doit citer une ligne précise pour ancrer son commentaire : sans
|
||||
/// numéros, il les compte lui-même et se décale de quelques lignes, ce qui place le
|
||||
/// commentaire à côté du code visé.
|
||||
/// The model must cite a precise line to anchor its comment: without numbers, it
|
||||
/// counts them itself and drifts by a few lines, which puts the comment next to
|
||||
/// the targeted code.
|
||||
fn number_lines(content: &str, first_line: u64) -> String {
|
||||
content
|
||||
.lines()
|
||||
@@ -291,8 +291,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn a_range_keeps_the_absolute_line_numbers() {
|
||||
// Un extrait lu à partir de la ligne 12 doit garder la numérotation du
|
||||
// fichier : sinon le modèle citerait des lignes décalées.
|
||||
// An excerpt read from line 12 must keep the file's numbering: otherwise the
|
||||
// model would cite shifted lines.
|
||||
assert_eq!(number_lines("x\ny", 12), "12:x\n13:y");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user