1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: fix open_file() on windows (fix #18245) (#18253)

This commit is contained in:
yuyi
2023-05-25 08:50:52 +08:00
committed by GitHub
parent 351b2e0e42
commit 190f5c69ea
3 changed files with 20 additions and 2 deletions

View File

@@ -418,7 +418,7 @@ fn test_open_file_wb_ab() {
mut afile := os.open_file('text.txt', 'ab', 0o666)!
afile.write_string('hello')!
afile.close()
assert os.read_file('text.txt')? == 'hellohello'
assert os.read_file('text.txt')! == 'hellohello'
}
fn test_open_append() {
@@ -438,3 +438,14 @@ fn test_open_append() {
f3.close()
assert os.read_lines(tfile)! == ['abc', 'abc', 'def']
}
fn test_open_file_on_chinese_windows() {
$if windows {
os.rm('.txt') or {}
mut f1 := os.open_file('.txt', 'w+', 0x666) or { panic(err) }
f1.write_string('test')!
f1.close()
assert os.read_file('.txt')! == 'test'
}
}