mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Integration testing harness
This commit is contained in:
parent
adb6cd5376
commit
308cab3e5c
@ -41,7 +41,7 @@
|
||||
|
||||
pub struct Application {
|
||||
compositor: Compositor,
|
||||
editor: Editor,
|
||||
pub editor: Editor,
|
||||
|
||||
config: Arc<ArcSwap<Config>>,
|
||||
|
||||
@ -193,7 +193,7 @@ fn render(&mut self) {
|
||||
scroll: None,
|
||||
};
|
||||
|
||||
self.compositor.render(&mut cx);
|
||||
// self.compositor.render(&mut cx);
|
||||
}
|
||||
|
||||
pub async fn event_loop(&mut self) {
|
||||
|
24
helix-term/tests/integration.rs
Normal file
24
helix-term/tests/integration.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use helix_term::{application::Application, args::Args, config::Config};
|
||||
use helix_view::current;
|
||||
|
||||
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
|
||||
|
||||
#[tokio::test]
|
||||
async fn it_works() {
|
||||
let args = Args::default();
|
||||
let config = Config::default();
|
||||
let mut app = Application::new(args, config).unwrap();
|
||||
|
||||
let inputs = &['i', 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'];
|
||||
|
||||
for input in inputs {
|
||||
// TODO: use input.parse::<KeyEvent>
|
||||
app.handle_terminal_events(Ok(Event::Key(KeyEvent {
|
||||
code: KeyCode::Char(*input),
|
||||
modifiers: KeyModifiers::NONE,
|
||||
})));
|
||||
}
|
||||
|
||||
let (_, doc) = current!(app.editor);
|
||||
assert_eq!(doc.text(), "hello world\n");
|
||||
}
|
Loading…
Reference in New Issue
Block a user