From 6124b5787be221d49a9bfbc983bd8e299fd1f38f Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Wed, 11 Oct 2023 10:44:13 +0100 Subject: [PATCH] tests: test output of `Buffer::get_name()` on terminal buffers --- tests/src/api/buffer.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/src/api/buffer.rs b/tests/src/api/buffer.rs index fbb27fb5..02c1ca3f 100644 --- a/tests/src/api/buffer.rs +++ b/tests/src/api/buffer.rs @@ -211,3 +211,18 @@ fn buf_set_get_option() { buf.set_option("modified", false).unwrap(); assert!(!buf.get_option::("modified").unwrap()); } + +#[oxi::test] +fn buf_terminal_name() { + api::command("term").unwrap(); + + let term_name_oxi = Buffer::current().get_name().unwrap(); + + let term_name_lua = + api::exec("lua =vim.api.nvim_buf_get_name(0)", true).unwrap().unwrap(); + + #[cfg(feature = "neovim-0-8")] + let term_name_lua = term_name_lua.trim_matches('"').to_owned(); + + assert_eq!(term_name_oxi.display().to_string(), term_name_lua); +}