Verified Commit 989b2087 authored by Phil Booth's avatar Phil Booth

wip

parent 90f3aaed
Pipeline #33034643 failed with stage
in 1 minute and 27 seconds
......@@ -19,4 +19,4 @@ test:cargo:
- rustc --version && cargo --version
- cargo fmt -- --check
- cargo clippy
- cargo t -- --test-threads=1
- cargo t
......@@ -363,7 +363,6 @@ impl Cursor {
let mut count = 0;
let mut new_line_id = None;
let mut started = true;
let mut finished = false;
if let Some(line_id) = self.line_id() {
if self.arena().read(line_id, &|line| line.is_newline_line()) {
......@@ -378,7 +377,6 @@ impl Cursor {
if self.arena().read(line_id, &|line| line.is_newline_line()) {
if started {
finished = true;
break;
}
} else if !started {
......
......@@ -22,7 +22,7 @@ fn grapheme() {
let arena = Arc::new(RwLock::new(TokenArena::new()));
let grapheme_id = arena.write().reserve_id(arena.clone());
let grapheme = Token::new_grapheme(arena.clone(), 0, " ");
arena.write().set(grapheme_id, grapheme);
arena.write().set(grapheme_id, grapheme).unwrap();
arena.read().read(grapheme_id, &|grapheme| {
assert_eq!(grapheme.len(), 1);
......@@ -40,7 +40,7 @@ fn unicode_grapheme() {
let arena = Arc::new(RwLock::new(TokenArena::new()));
let grapheme_id = arena.write().reserve_id(arena.clone());
let grapheme = Token::new_grapheme(arena.clone(), 0, "💩");
arena.write().set(grapheme_id, grapheme);
arena.write().set(grapheme_id, grapheme).unwrap();
arena.read().read(grapheme_id, &|grapheme| {
assert_eq!(grapheme.len(), 1);
......@@ -97,7 +97,7 @@ fn word() {
let grapheme_ids = parse::graphemes(arena.clone(), "wibble").unwrap();
let word_id = arena.write().reserve_id(arena.clone());
let word = Token::new_word(arena.clone(), word_id, &grapheme_ids);
arena.write().set(word_id, word);
arena.write().set(word_id, word).unwrap();
arena.read().read(word_id, &|word| {
assert_eq!(word.len(), 6);
......@@ -126,7 +126,7 @@ fn unicode_word() {
let grapheme_ids = parse::graphemes(arena.clone(), "🐮🐼🐸").unwrap();
let word_id = arena.write().reserve_id(arena.clone());
let word = Token::new_word(arena.clone(), word_id, &grapheme_ids);
arena.write().set(word_id, word);
arena.write().set(word_id, word).unwrap();
arena.read().read(word_id, &|word| {
assert_eq!(word.len(), 3);
......@@ -172,7 +172,7 @@ fn line() {
let word_ids = parse::words(arena.clone(), "foo bar baz qux").unwrap();
let line_id = arena.write().reserve_id(arena.clone());
let line = Token::new_line(arena.clone(), line_id, &word_ids);
arena.write().set(line_id, line);
arena.write().set(line_id, line).unwrap();
arena.read().read(line_id, &|line| {
assert_eq!(line.len(), 15);
......@@ -229,7 +229,7 @@ fn unicode_line() {
let word_ids = parse::words(arena.clone(), "🐮🐼🐸 🍺🍷🍸").unwrap();
let line_id = arena.write().reserve_id(arena.clone());
let line = Token::new_line(arena.clone(), line_id, &word_ids);
arena.write().set(line_id, line);
arena.write().set(line_id, line).unwrap();
arena.read().read(line_id, &|line| {
assert_eq!(line.len(), 7);
......@@ -273,7 +273,7 @@ fn paragraph() {
let line_ids = parse::lines(arena.clone(), "foo bar\nbaz qux\r\nwibble").unwrap();
let paragraph_id = arena.write().reserve_id(arena.clone());
let paragraph = Token::new_paragraph(arena.clone(), paragraph_id, &line_ids);
arena.write().set(paragraph_id, paragraph);
arena.write().set(paragraph_id, paragraph).unwrap();
arena.read().read(paragraph_id, &|paragraph| {
assert_eq!(paragraph.len(), 22);
......@@ -330,7 +330,7 @@ fn terminates() {
let arena = Arc::new(RwLock::new(TokenArena::new()));
let grapheme_id = arena.write().reserve_id(arena.clone());
let grapheme = Token::new_grapheme(arena.clone(), 0, " ");
arena.write().set(grapheme_id, grapheme);
arena.write().set(grapheme_id, grapheme).unwrap();
arena.read().mutate(grapheme_id, &|mut grapheme| {
grapheme.set_terminates(TokenType::Word);
......@@ -680,15 +680,15 @@ fn delete_middle_token_with_children() {
let one_id = arena.write().reserve_id(arena.clone());
let one = Token::new_word(arena.clone(), one_id, &grapheme_ids[0..3]);
arena.write().set(one_id, one);
arena.write().set(one_id, one).unwrap();
let two_id = arena.write().reserve_id(arena.clone());
let two = Token::new_word(arena.clone(), two_id, &grapheme_ids[3..6]);
arena.write().set(two_id, two);
arena.write().set(two_id, two).unwrap();
let three_id = arena.write().reserve_id(arena.clone());
let three = Token::new_word(arena.clone(), three_id, &grapheme_ids[6..]);
arena.write().set(three_id, three);
arena.write().set(three_id, three).unwrap();
arena.read().mutate(one_id, &|mut one| {
one.set_next_and_cascade(two_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment