The added test points out a regression since b0ab1b76029eaface724a28483fe8b0ea36029dc, which is noticed when running MSVC 2010 in wine.
Signed-off-by: Martin Storsjo martin@martin.st --- dlls/msvcrt/tests/file.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index ecf99e38b0e..9ad91b578f5 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -1039,6 +1039,37 @@ static void test_fgetwc_unicode(void) ch = fgetwc(tempfh); ok(ch == WEOF, "got %04hx, expected WEOF (unicode)\n", ch); fclose(tempfh); + + // Test missing bom + tempfh = fopen(tempfile, "wb"); + ok(tempfh != NULL, "can't open tempfile\n"); + fwrite("1234", 1, 4, tempfh); + fclose(tempfh); + + tempfh = fopen(tempfile, "rt, ccs=UTF-8"); + ok(tempfh != NULL, "can't open tempfile\n"); + for (i = 0; i < 4; i++) + { + ch = fgetwc(tempfh); + ok(ch == '1' + i, + "got %04hx, expected %04x\n", ch, '1' + i); + } + ch = fgetwc(tempfh); + ok(ch == WEOF, "got %04hx, expected WEOF (utf8)\n", ch); + fclose(tempfh); + + tempfh = fopen(tempfile, "rt, ccs=utf-16le"); + ok(tempfh != NULL, "can't open tempfile\n"); + for (i = 0; i < 4; i++) + { + ch = fgetwc(tempfh); + todo_wine ok(ch == '1' + i, + "got %04hx, expected %04x\n", ch, '1' + i); + } + ch = fgetwc(tempfh); + ok(ch == WEOF, "got %04hx, expected WEOF (utf8)\n", ch); + fclose(tempfh); + unlink(temppath); }