Add script to build everything and run all tests
This commit is contained in:
parent
d49e8881fd
commit
9a6a01a672
3 changed files with 11 additions and 35 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use cosmic_text::{Action, Buffer, Color, Editor, FontSystem, Metrics, SwashCache};
|
use cosmic_text::{Action, Buffer, Color, Editor, FontSystem, Metrics, SwashCache};
|
||||||
use orbclient::{EventOption, Renderer, Window, WindowFlag};
|
use orbclient::{EventOption, Renderer, Window, WindowFlag};
|
||||||
use std::{env, fs, process, thread, time::{Duration, Instant}};
|
use std::{env, fs, process, time::Instant};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
fn redraw(window: &mut Window, editor: &mut Editor<'_>, swash_cache: &mut SwashCache) {
|
fn redraw(window: &mut Window, editor: &mut Editor<'_>, swash_cache: &mut SwashCache) {
|
||||||
|
|
@ -154,19 +154,9 @@ fn main() {
|
||||||
}
|
}
|
||||||
if wrong == 0 {
|
if wrong == 0 {
|
||||||
log::info!("All lines matched!");
|
log::info!("All lines matched!");
|
||||||
|
process::exit(0);
|
||||||
} else {
|
} else {
|
||||||
log::error!("{} lines did not match!", wrong);
|
log::error!("{} lines did not match!", wrong);
|
||||||
}
|
process::exit(1);
|
||||||
|
|
||||||
//TODO: make window not async?
|
|
||||||
loop {
|
|
||||||
for event in window.events() {
|
|
||||||
match event.to_option() {
|
|
||||||
EventOption::Quit(_) => process::exit(0),
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
thread::sleep(Duration::from_millis(1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,11 +252,6 @@ impl<'a> Editor<'a> {
|
||||||
} else {
|
} else {
|
||||||
let line = &mut self.buffer.lines[self.cursor.line];
|
let line = &mut self.buffer.lines[self.cursor.line];
|
||||||
|
|
||||||
println!("Before");
|
|
||||||
for span in line.attrs_list().spans() {
|
|
||||||
println!("{:?}", span);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect text after insertion as a line
|
// Collect text after insertion as a line
|
||||||
let after = line.split_off(self.cursor.index);
|
let after = line.split_off(self.cursor.index);
|
||||||
|
|
||||||
|
|
@ -269,11 +264,6 @@ impl<'a> Editor<'a> {
|
||||||
// Append the text after insertion
|
// Append the text after insertion
|
||||||
line.append(after);
|
line.append(after);
|
||||||
|
|
||||||
println!("After");
|
|
||||||
for span in line.attrs_list().spans() {
|
|
||||||
println!("{:?}", span);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.cursor.index += character.len_utf8();
|
self.cursor.index += character.len_utf8();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -289,11 +279,6 @@ impl<'a> Editor<'a> {
|
||||||
if self.cursor.index > 0 {
|
if self.cursor.index > 0 {
|
||||||
let line = &mut self.buffer.lines[self.cursor.line];
|
let line = &mut self.buffer.lines[self.cursor.line];
|
||||||
|
|
||||||
println!("Before");
|
|
||||||
for span in line.attrs_list().spans() {
|
|
||||||
println!("{:?}", span);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get text line after cursor
|
// Get text line after cursor
|
||||||
let after = line.split_off(self.cursor.index);
|
let after = line.split_off(self.cursor.index);
|
||||||
|
|
||||||
|
|
@ -307,8 +292,6 @@ impl<'a> Editor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("Move cursor {} to {}", self.cursor.index, prev_index);
|
|
||||||
|
|
||||||
self.cursor.index = prev_index;
|
self.cursor.index = prev_index;
|
||||||
|
|
||||||
// Remove character
|
// Remove character
|
||||||
|
|
@ -316,11 +299,6 @@ impl<'a> Editor<'a> {
|
||||||
|
|
||||||
// Add text after cursor
|
// Add text after cursor
|
||||||
line.append(after);
|
line.append(after);
|
||||||
|
|
||||||
println!("After");
|
|
||||||
for span in line.attrs_list().spans() {
|
|
||||||
println!("{:?}", span);
|
|
||||||
}
|
|
||||||
} else if self.cursor.line > 0 {
|
} else if self.cursor.line > 0 {
|
||||||
let mut line_index = self.cursor.line;
|
let mut line_index = self.cursor.line;
|
||||||
let old_line = self.buffer.lines.remove(line_index);
|
let old_line = self.buffer.lines.remove(line_index);
|
||||||
|
|
|
||||||
8
test.sh
Executable file
8
test.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cargo doc
|
||||||
|
cargo test
|
||||||
|
cargo build --release --all
|
||||||
|
env RUST_LOG=editor_test=info target/release/editor-test
|
||||||
Loading…
Add table
Add a link
Reference in a new issue