Skip to content

Commit

Permalink
Change lua append_file_text and write_file_text data parameter to text
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsenkbeil committed Oct 10, 2021
1 parent 3c50bec commit 909fe9c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions distant-lua-tests/tests/lua/async/append_file_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions distant-lua-tests/tests/lua/async/write_file_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions distant-lua-tests/tests/lua/sync/append_file_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
})
Expand All @@ -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();

Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions distant-lua-tests/tests/lua/sync/write_file_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
})
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions distant-lua/src/session/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ make_api!(append_file, (), { path: PathBuf, data: Vec<u8> }, |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| {
Expand Down Expand Up @@ -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 }
);

0 comments on commit 909fe9c

Please sign in to comment.