()
| 187 | |
| 188 | #[test] |
| 189 | fn test_insert() { |
| 190 | let mut buffer = LineBuffer::default(); |
| 191 | buffer.insert(0, 'c'); // c |
| 192 | buffer.insert(0, 'é'); // éc |
| 193 | |
| 194 | // Insertion must happen after the 2-byte UTF-8 code point and not at byte 1. |
| 195 | buffer.insert(1, 'à'); // éàc |
| 196 | buffer.insert(100, 'd'); // Should not panic even if the given position is invalid. |
| 197 | |
| 198 | assert_eq!(buffer.into_inner(), "éàcd"); |
| 199 | } |
| 200 | |
| 201 | #[test] |
| 202 | fn test_remove() { |