mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 793949 - Test that OS.File.copy overwrites rather than appending. r=froydnj
This commit is contained in:
parent
030b6921a1
commit
0d64618fca
@ -351,6 +351,27 @@ function test_copy_existing_file()
|
||||
ok(true, "test_copy_existing: Copy complete");
|
||||
compare_files("test_copy_existing", src_file_name, tmp_file_name);
|
||||
|
||||
// Create a bogus file with arbitrary content, then attempt to overwrite
|
||||
// it with |copy|.
|
||||
let dest = OS.File.open(tmp_file_name, {trunc: true});
|
||||
let buf = new ArrayBuffer(50);
|
||||
dest.write(buf);
|
||||
dest.close();
|
||||
|
||||
OS.File.copy(src_file_name, tmp_file_name);
|
||||
|
||||
compare_files("test_copy_existing 2", src_file_name, tmp_file_name);
|
||||
|
||||
// Attempt to overwrite with noOverwrite
|
||||
let exn;
|
||||
try {
|
||||
OS.File.copy(src_file_name, tmp_file_name, {noOverwrite: true});
|
||||
} catch(x) {
|
||||
exn = x;
|
||||
}
|
||||
ok(!!exn, "test_copy_existing: noOverwrite prevents overwriting existing files");
|
||||
|
||||
|
||||
ok(true, "test_copy_existing: Cleaning up");
|
||||
OS.File.remove(tmp_file_name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user