Change lua append_file_text and write_file_text data parameter to text

pull/96/head
Chip Senkbeil 3 years ago
parent 3c50bec8ea
commit 909fe9c7ba
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -27,7 +27,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
// Because of our scheduler, the invocation turns async -> sync // Because of our scheduler, the invocation turns async -> sync
local err 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 if not success then
err = res err = res
end end
@ -42,7 +42,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
} }
#[rstest] #[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 lua = lua::make().unwrap();
let new_session = session::make_function(&lua, ctx).unwrap(); let new_session = session::make_function(&lua, ctx).unwrap();
let schedule_fn = poll::make_function(&lua).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 // Because of our scheduler, the invocation turns async -> sync
local err 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 if not success then
err = res err = res
end end

@ -27,7 +27,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
// Because of our scheduler, the invocation turns async -> sync // Because of our scheduler, the invocation turns async -> sync
local err 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 if not success then
err = res err = res
end end
@ -64,7 +64,7 @@ fn should_overwrite_existing_file(ctx: &'_ DistantServerCtx) {
// Because of our scheduler, the invocation turns async -> sync // Because of our scheduler, the invocation turns async -> sync
local err 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 if not success then
err = res err = res
end end

@ -21,7 +21,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
local session = $new_session() local session = $new_session()
local status, _ = pcall(session.append_file_text, session, { local status, _ = pcall(session.append_file_text, session, {
path = $file_path, path = $file_path,
data = $text text = $text
}) })
assert(not status, "Unexpectedly succeeded!") assert(not status, "Unexpectedly succeeded!")
}) })
@ -33,7 +33,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
} }
#[rstest] #[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 lua = lua::make().unwrap();
let new_session = session::make_function(&lua, ctx).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() local session = $new_session()
session:append_file_text({ session:append_file_text({
path = $file_path, path = $file_path,
data = $text text = $text
}) })
}) })
.exec(); .exec();

@ -21,7 +21,7 @@ fn should_yield_error_if_fails_to_create_file(ctx: &'_ DistantServerCtx) {
local session = $new_session() local session = $new_session()
local status, _ = pcall(session.write_file_text, session, { local status, _ = pcall(session.write_file_text, session, {
path = $file_path, path = $file_path,
data = $text text = $text
}) })
assert(not status, "Unexpectedly succeeded!") assert(not status, "Unexpectedly succeeded!")
}) })
@ -49,7 +49,7 @@ fn should_overwrite_existing_file(ctx: &'_ DistantServerCtx) {
local session = $new_session() local session = $new_session()
session:write_file_text({ session:write_file_text({
path = $file_path, path = $file_path,
data = $text text = $text
}) })
}) })
.exec(); .exec();

@ -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 channel.append_file(tenant, params.path, params.data).await
}); });
make_api!(append_file_text, (), { path: PathBuf, data: String }, |channel, tenant, params| { make_api!(append_file_text, (), { path: PathBuf, text: String }, |channel, tenant, params| {
channel.append_file_text(tenant, params.path, params.data).await channel.append_file_text(tenant, params.path, params.text).await
}); });
make_api!(copy, (), { src: PathBuf, dst: PathBuf }, |channel, tenant, params| { make_api!(copy, (), { src: PathBuf, dst: PathBuf }, |channel, tenant, params| {
@ -200,6 +200,6 @@ make_api!(
make_api!( make_api!(
write_file_text, write_file_text,
(), (),
{ path: PathBuf, data: String }, { path: PathBuf, text: String },
|channel, tenant, params| { channel.write_file_text(tenant, params.path, params.data).await } |channel, tenant, params| { channel.write_file_text(tenant, params.path, params.text).await }
); );

Loading…
Cancel
Save