test(smart-select): click the contraction that sits between two quotes

`quote_range` refuses outright when the clicked apostrophe is a contraction,
and no test ever clicked one that had anything to pair with. The parity
count already skips contractions, so on a line carrying no real quote there
is nothing to pair with and the refusal looks redundant — every fixture was
that line.

`echo 'it isn't so' done` is not. Dropping the refusal makes a click inside
`isn't` select `'it isn'`: a range that opens at a quote and stops in the
middle of a word. The fixture was already there; only the interesting click
was missing.
This commit is contained in:
l0ng-ai
2026-08-24 00:46:34 +08:00
parent f27dce6838
commit 0a4ff5697b
+15
View File
@@ -827,6 +827,21 @@ mod tests {
let close = chars.iter().rposition(|&c| c == '\'').unwrap();
assert_eq!(quote_range(&chars, open), Some((open, close)));
assert_eq!(quote_range(&chars, close), Some((open, close)));
// And the contraction's own apostrophe pairs with nothing. It is the
// only click that reaches the refusal in `quote_range` itself: the
// parity count already skips contractions, so on a line with no real
// quote on it there is nothing for a contraction to pair with anyway,
// and the check looks redundant. Here there is — clicking inside
// `isn't` would take `'it isn'`, a selection that starts at a quote
// and stops in the middle of a word.
let contraction = chars
.iter()
.position(|&c| c == '\'')
.and_then(|first| chars[first + 1..].iter().position(|&c| c == '\''))
.map(|i| i + open + 1)
.expect("the fixture has a contraction between its quotes");
assert_eq!(quote_range(&chars, contraction), None);
}
#[test]