@@ -31,3 +31,35 @@ pub fn nth_prev_word_boundary(slice: RopeSlice, mut char_idx: usize, count: usiz
31 char_idx + 1
31 char_idx + 1
36+fn different_prev_word_boundary() {
39+ let text = Rope::from(x);
40+ let out = nth_prev_word_boundary(text.slice(..), text.len_chars() - 1, 1);
41+ assert_eq!(text.slice(..out), y, r#"from "{}""#, x);
43+ t("abcd\nefg\nwrs", "abcd\nefg\n");
44+ t("abcd\nefg\n", "abcd\n");
46+ t("hello, world!", "hello, world");
47+ t("hello, world", "hello, ");
48+ t("hello, ", "hello");
50+ t("こんにちは、世界!", "こんにちは、世界!"); // TODO: punctuation
51+ t("こんにちは、世界", "こんにちは、");
52+ t("こんにちは、", "こんにちは、"); // what?
54+ t("この世界。", "この世界。"); // what?
57+ t("その300円です", ""); // TODO: should stop at 300
58+ t("唱k", ""); // TODO: should stop at 唱
59+ t("1 + 1 = 2", "1 + 1 = ");
60+ t("1 + 1 =", "1 + 1 ");