Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- dlls/scrrun/tests/filesystem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index 8b06dbb883d..559e4c33b5b 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -472,6 +472,20 @@ static void test_GetFileName(void) } }
+static void test_GetTempName(void) +{ + BSTR result; + HRESULT hr; + + hr = IFileSystem3_GetTempName(fs3, NULL); + ok(hr == E_POINTER, "GetTempName returned %x, expected E_POINTER\n", hr); + result = (BSTR)0xdeadbeef; + hr = IFileSystem3_GetTempName(fs3, &result); + ok(hr == S_OK, "GetTempName returned %x, expected S_OK\n", hr); + todo_wine ok(wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result)); + SysFreeString(result); +} + static void test_GetBaseName(void) { static const struct @@ -2598,6 +2612,7 @@ START_TEST(filesystem) test_GetBaseName(); test_GetAbsolutePathName(); test_GetFile(); + test_GetTempName(); test_CopyFolder(); test_BuildPath(); test_GetFolder(); -- 2.31.1
Hi, Robert.
This looks fine, except for the compilation warning due to pointer return type of wcsstr():
CC dlls/scrrun/tests/filesystem.cross.o ../../wine-git/dlls/scrrun/tests/filesystem.c: In function ‘test_GetTempName’: ../../wine-git/dlls/scrrun/tests/filesystem.c:485:18: warning: passing argument 1 of ‘winetest_ok’ makes integer from pointer without a cast [-Wint-conversion] 485 | todo_wine ok(wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result)); | ^~~~~~~~~~~~~~~~~~~~~~~ | | | wchar_t * {aka short unsigned int *} In file included from ../../wine-git/dlls/scrrun/tests/filesystem.c:31: ../../wine-git/include/wine/test.h:94:47: note: expected ‘int’ but argument is of type ‘wchar_t *’ {aka ‘short unsigned int *’} 94 | extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __WINE_PRINTF_ATTR(2,3); | ~~~~^~~~~~~~~ CCLD dlls/scrrun/tests/scrrun_test.exe
You can use ok(!!wcsstr..) to fix this.
Hi Nikolay, Thanks for the review. Strange that I did not notice compiler warning. , testbot shows it for 32 and 64 bit. I will send updated patch this evening.
Robert
Am 24.01.2022 um 09:29 schrieb Nikolay Sivov nsivov@codeweavers.com:
Hi, Robert.
This looks fine, except for the compilation warning due to pointer return type of wcsstr():
CC dlls/scrrun/tests/filesystem.cross.o ../../wine-git/dlls/scrrun/tests/filesystem.c: In function ‘test_GetTempName’: ../../wine-git/dlls/scrrun/tests/filesystem.c:485:18: warning: passing argument 1 of ‘winetest_ok’ makes integer from pointer without a cast [-Wint-conversion] 485 | todo_wine ok(wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result)); | ^~~~~~~~~~~~~~~~~~~~~~~ | | | wchar_t * {aka short unsigned int *} In file included from ../../wine-git/dlls/scrrun/tests/filesystem.c:31: ../../wine-git/include/wine/test.h:94:47: note: expected ‘int’ but argument is of type ‘wchar_t *’ {aka ‘short unsigned int *’} 94 | extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __WINE_PRINTF_ATTR(2,3); | ~~~~^~~~~~~~~ CCLD dlls/scrrun/tests/scrrun_test.exe
You can use ok(!!wcsstr..) to fix this.
Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- v2: Warning fix as suggested by Nikolay. --- dlls/scrrun/tests/filesystem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index 8b06dbb883d..1886c52d009 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -472,6 +472,20 @@ static void test_GetFileName(void) } }
+static void test_GetTempName(void) +{ + BSTR result; + HRESULT hr; + + hr = IFileSystem3_GetTempName(fs3, NULL); + ok(hr == E_POINTER, "GetTempName returned %x, expected E_POINTER\n", hr); + result = (BSTR)0xdeadbeef; + hr = IFileSystem3_GetTempName(fs3, &result); + ok(hr == S_OK, "GetTempName returned %x, expected S_OK\n", hr); + todo_wine ok(!!wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result)); + SysFreeString(result); +} + static void test_GetBaseName(void) { static const struct @@ -2598,6 +2612,7 @@ START_TEST(filesystem) test_GetBaseName(); test_GetAbsolutePathName(); test_GetFile(); + test_GetTempName(); test_CopyFolder(); test_BuildPath(); test_GetFolder(); -- 2.31.1
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
+static void test_GetTempName(void) +{
- BSTR result;
- HRESULT hr;
- hr = IFileSystem3_GetTempName(fs3, NULL);
- ok(hr == E_POINTER, "GetTempName returned %x, expected E_POINTER\n", hr);
- result = (BSTR)0xdeadbeef;
- hr = IFileSystem3_GetTempName(fs3, &result);
- ok(hr == S_OK, "GetTempName returned %x, expected S_OK\n", hr);
- todo_wine ok(!!wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result));
- SysFreeString(result);
+}
Note that you don't need to initialize "result" here, it's usually done like that if you expect null return value.