@@ -327,6 +327,35 @@ async def test_async_sandbox_files_e2e():
327327 assert await sandbox .files .read_text (existing_target ) == "existing target"
328328 assert (await sandbox .files .get_info (destination_link )).symlink_target is None
329329
330+ move_source = f"{ base_dir } /move-overwrite/source.txt"
331+ move_existing_target = f"{ base_dir } /move-overwrite/existing-target.txt"
332+ move_destination_link = f"{ base_dir } /move-overwrite/destination-link.txt"
333+ await sandbox .files .write_text (move_source , "move source payload" )
334+ await sandbox .files .write_text (move_existing_target , "move existing target" )
335+ result = await sandbox .exec (
336+ _bash_exec (
337+ f'mkdir -p "{ base_dir } /move-overwrite" && ln -sfn "{ move_existing_target } " "{ move_destination_link } "'
338+ )
339+ )
340+ assert result .exit_code == 0
341+ await sandbox .files .move (
342+ source = move_source ,
343+ destination = move_destination_link ,
344+ overwrite = True ,
345+ )
346+ assert (
347+ await sandbox .files .read_text (move_destination_link )
348+ == "move source payload"
349+ )
350+ assert (
351+ await sandbox .files .read_text (move_existing_target )
352+ == "move existing target"
353+ )
354+ assert (
355+ await sandbox .files .get_info (move_destination_link )
356+ ).symlink_target is None
357+ assert await sandbox .files .exists (move_source ) is False
358+
330359 chmod_path = f"{ base_dir } /chmod/file.txt"
331360 await sandbox .files .write_text (chmod_path , "chmod me" )
332361 await sandbox .files .chmod (path = chmod_path , mode = "0640" )
0 commit comments