Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5778bdbc
Commit
5778bdbc
authored
Jan 10, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added write tests on unicode files.
parent
94e36475
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
file.c
dlls/msvcrt/tests/file.c
+41
-1
No files found.
dlls/msvcrt/tests/file.c
View file @
5778bdbc
...
...
@@ -975,7 +975,7 @@ static void test_file_write_read( void )
free
(
tempf
);
tempf
=
_tempnam
(
"."
,
"wne"
);
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_BINARY
|
_O_RDWR
,
0
);
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_BINARY
|
_O_RDWR
,
_S_IWRITE
);
ok
(
tempfd
!=
-
1
,
"Can't open '%s': %d
\n
"
,
tempf
,
errno
);
/* open in BINARY mode */
ok
(
_write
(
tempfd
,
dostext
,
strlen
(
dostext
))
==
lstrlenA
(
dostext
),
...
...
@@ -1011,6 +1011,46 @@ static void test_file_write_read( void )
ok
(
i
==
strlen
(
mytext
)
-
1
,
"_read_i %d
\n
"
,
i
);
_close
(
tempfd
);
/* test read/write in unicode mode */
if
(
p_fopen_s
)
{
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_WRONLY
|
_O_WTEXT
,
_S_IWRITE
);
ok
(
tempfd
!=
-
1
,
"_open failed with error: %d
\n
"
,
errno
);
ret
=
_write
(
tempfd
,
"a"
,
1
);
ok
(
ret
==
-
1
,
"_write returned %d, expected -1
\n
"
,
ret
);
ret
=
_write
(
tempfd
,
"a
\x00\n\x00\xff\xff
"
,
6
);
ok
(
ret
==
6
,
"_write returned %d, expected 6
\n
"
,
ret
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_BINARY
,
0
);
ok
(
tempfd
!=
-
1
,
"_open failed with error: %d
\n
"
,
errno
);
ret
=
_read
(
tempfd
,
btext
,
sizeof
(
btext
));
ok
(
ret
==
10
,
"_read returned %d, expected 10
\n
"
,
ret
);
ok
(
!
memcmp
(
btext
,
"
\xff\xfe\x61\x00\r\x00\n\x00\xff\xff
"
,
10
),
"btext is incorrect
\n
"
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_WRONLY
|
_O_U8TEXT
,
_S_IWRITE
);
ok
(
tempfd
!=
-
1
,
"_open failed with error: %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
ret
=
_write
(
tempfd
,
"a"
,
1
);
ok
(
ret
==
-
1
,
"_write returned %d, expected -1
\n
"
,
ret
);
ok
(
errno
==
22
,
"errno = %d
\n
"
,
errno
);
ret
=
_write
(
tempfd
,
"a
\x00\n\x00\x62\x00
"
,
6
);
ok
(
ret
==
6
,
"_write returned %d, expected 6
\n
"
,
ret
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_BINARY
,
0
);
ok
(
tempfd
!=
-
1
,
"_open failed with error: %d
\n
"
,
errno
);
ret
=
_read
(
tempfd
,
btext
,
sizeof
(
btext
));
ok
(
ret
==
7
,
"_read returned %d, expected 7
\n
"
,
ret
);
ok
(
!
memcmp
(
btext
,
"
\xef\xbb\xbf\x61\r\n\x62
"
,
7
),
"btext is incorrect
\n
"
);
_close
(
tempfd
);
}
else
{
win_skip
(
"unicode mode tests on file
\n
"
);
}
ret
=
_chmod
(
tempf
,
_S_IREAD
|
_S_IWRITE
);
ok
(
ret
==
0
,
"Can't chmod '%s' to read-write: %d
\n
"
,
tempf
,
errno
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment