test(core): the adapter's line-ending answer needs every break to be CR LF

contains(CR LF) answered cr-lf for a file mixing CR LF and bare LF. Now the
count of LF must equal the count of CR LF for cr-lf, with none CR LF for lf,
and a mix is mixed. The claims say the engine has no host notion, so
host_line_ending is unused (BS-format-4).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-09 11:17:14 -07:00
1 parent 695aee7a1e
commit bab7ac72ca
2 files changed
+14 -7

No files matched your search

@@ -27,15 +27,22 @@ impl Books<'_> {
))
}
"iif_line_ending" => {
// The file's own bytes: CR LF (wanderbooks' pick, cr-lf)
// or the host's line ending. The engine writes CR LF on
// every platform, so the first line ending is the file's.
let ending = if iif.text.contains("\r\n") {
// The file's own bytes: every line break is CR LF
// (wanderbooks' pick, cr-lf), every one a bare LF, or a mix
// of the two, which is neither. The engine has no notion of
// a host, so the example's `setup.host_line_ending` is not
// read here.
let text = iif.text.as_str();
let lf = text.matches('\n').count();
let crlf = text.matches("\r\n").count();
let ending = if lf == 0 {
"none"
} else if lf == crlf {
"cr-lf"
} else if iif.text.contains('\n') {
} else if crlf == 0 {
"lf"
} else {
"cr-lf"
"mixed"
};
Ok(json_figures([(
"line_ending".to_string(),
+1 -1
View File
@@ -342,7 +342,7 @@ examples `format-cr-lf-on-an-lf-platform` and
`format-no-customer-or-vendor-name` (BS-format-9), run by
`every_bookspec_example_holds` and
`the_runner_reports_every_claimed_rule_green`; the line ending is asked by
the iif_line_ending query (the adapter's answer_iif), the file's own CR LF.
the iif_line_ending query (the adapter's answer_iif), which reads the file's own bytes: cr-lf when every line break is CR LF, lf when every one is a bare LF, mixed when it is neither. The engine has no notion of a host, so the adapter does not use an example's host_line_ending setup.
### Product rules