From 909fe9c7bab1ebc8226758a2820c59dca0bd2b35 Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Sat, 9 Oct 2021 20:50:50 -0500 Subject: [PATCH] Change lua append_file_text and write_file_text data parameter to text --- distant-lua-tests/tests/lua/async/append_file_text.rs | 6 +++--- distant-lua-tests/tests/lua/async/write_file_text.rs | 4 ++-- distant-lua-tests/tests/lua/sync/append_file_text.rs | 6 +++--- distant-lua-tests/tests/lua/sync/write_file_text.rs | 4 ++-- distant-lua/src/session/api.rs | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/distant-lua-tests/tests/lua/async/append_file_text.rs b/distant-lua-tests/tests/lua/async/append_file_text.rs index 12070ea..fca7cdf 100644 --- a/distant-lua-tests/tests/lua/async/append_file_text.rs +++ b/distant-lua-tests/tests/lua/async/append_file_text.rs @@ -27,7 +27,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { // Because of our scheduler, the invocation turns async -> sync local err - f(session, { path = $file_path, data = $text }, function(success, res) + f(session, { path = $file_path, text = $text }, function(success, res) if not success then err = res end @@ -42,7 +42,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { } #[rstest] -fn should_append_data_to_existing_file(ctx: &'_ DistantServerCtx) { +fn should_append_text_to_existing_file(ctx: &'_ DistantServerCtx) { let lua = lua::make().unwrap(); let new_session = session::make_function(&lua, ctx).unwrap(); let schedule_fn = poll::make_function(&lua).unwrap(); @@ -64,7 +64,7 @@ fn should_append_data_to_existing_file(ctx: &'_ DistantServerCtx) { // Because of our scheduler, the invocation turns async -> sync local err - f(session, { path = $file_path, data = $text }, function(success, res) + f(session, { path = $file_path, text = $text }, function(success, res) if not success then err = res end diff --git a/distant-lua-tests/tests/lua/async/write_file_text.rs b/distant-lua-tests/tests/lua/async/write_file_text.rs index 2490bce..00d6b15 100644 --- a/distant-lua-tests/tests/lua/async/write_file_text.rs +++ b/distant-lua-tests/tests/lua/async/write_file_text.rs @@ -27,7 +27,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { // Because of our scheduler, the invocation turns async -> sync local err - f(session, { path = $file_path, data = $text }, function(success, res) + f(session, { path = $file_path, text = $text }, function(success, res) if not success then err = res end @@ -64,7 +64,7 @@ fn should_overwrite_existing_file(ctx: &'_ DistantServerCtx) { // Because of our scheduler, the invocation turns async -> sync local err - f(session, { path = $file_path, data = $text }, function(success, res) + f(session, { path = $file_path, text = $text }, function(success, res) if not success then err = res end diff --git a/distant-lua-tests/tests/lua/sync/append_file_text.rs b/distant-lua-tests/tests/lua/sync/append_file_text.rs index abbc134..85ed640 100644 --- a/distant-lua-tests/tests/lua/sync/append_file_text.rs +++ b/distant-lua-tests/tests/lua/sync/append_file_text.rs @@ -21,7 +21,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { local session = $new_session() local status, _ = pcall(session.append_file_text, session, { path = $file_path, - data = $text + text = $text }) assert(not status, "Unexpectedly succeeded!") }) @@ -33,7 +33,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { } #[rstest] -fn should_append_data_to_existing_file(ctx: &'_ DistantServerCtx) { +fn should_append_text_to_existing_file(ctx: &'_ DistantServerCtx) { let lua = lua::make().unwrap(); let new_session = session::make_function(&lua, ctx).unwrap(); @@ -49,7 +49,7 @@ fn should_append_data_to_existing_file(ctx: &'_ DistantServerCtx) { local session = $new_session() session:append_file_text({ path = $file_path, - data = $text + text = $text }) }) .exec(); diff --git a/distant-lua-tests/tests/lua/sync/write_file_text.rs b/distant-lua-tests/tests/lua/sync/write_file_text.rs index 3d150b5..e0b9457 100644 --- a/distant-lua-tests/tests/lua/sync/write_file_text.rs +++ b/distant-lua-tests/tests/lua/sync/write_file_text.rs @@ -21,7 +21,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) { local session = $new_session() local status, _ = pcall(session.write_file_text, session, { path = $file_path, - data = $text + text = $text }) assert(not status, "Unexpectedly succeeded!") }) @@ -49,7 +49,7 @@ fn should_overwrite_existing_file(ctx: &'_ DistantServerCtx) { local session = $new_session() session:write_file_text({ path = $file_path, - data = $text + text = $text }) }) .exec(); diff --git a/distant-lua/src/session/api.rs b/distant-lua/src/session/api.rs index 1edf374..230cad7 100644 --- a/distant-lua/src/session/api.rs +++ b/distant-lua/src/session/api.rs @@ -74,8 +74,8 @@ make_api!(append_file, (), { path: PathBuf, data: Vec }, |channel, tenant, p channel.append_file(tenant, params.path, params.data).await }); -make_api!(append_file_text, (), { path: PathBuf, data: String }, |channel, tenant, params| { - channel.append_file_text(tenant, params.path, params.data).await +make_api!(append_file_text, (), { path: PathBuf, text: String }, |channel, tenant, params| { + channel.append_file_text(tenant, params.path, params.text).await }); make_api!(copy, (), { src: PathBuf, dst: PathBuf }, |channel, tenant, params| { @@ -200,6 +200,6 @@ make_api!( make_api!( write_file_text, (), - { path: PathBuf, data: String }, - |channel, tenant, params| { channel.write_file_text(tenant, params.path, params.data).await } + { path: PathBuf, text: String }, + |channel, tenant, params| { channel.write_file_text(tenant, params.path, params.text).await } );