From 308cab3e5cd5e8d5a8c37498e725f51ab101a908 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 26 Oct 2021 18:03:03 +0900 Subject: Integration testing harness --- helix-term/tests/integration.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 helix-term/tests/integration.rs (limited to 'helix-term/tests') diff --git a/helix-term/tests/integration.rs b/helix-term/tests/integration.rs new file mode 100644 index 00000000..1ef618f7 --- /dev/null +++ b/helix-term/tests/integration.rs @@ -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:: + 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"); +} -- cgit v1.2.3-70-g09d2