Commit e7e99800 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

kernel32/tests: Test the expansion of indirect environment variable references.

parent 269cb45f
...@@ -274,9 +274,19 @@ static void test_ExpandEnvironmentStringsA(void) ...@@ -274,9 +274,19 @@ static void test_ExpandEnvironmentStringsA(void)
ret_size1 = GetWindowsDirectoryA(buf1,256); ret_size1 = GetWindowsDirectoryA(buf1,256);
ok ((ret_size1 >0) && (ret_size1<256), "GetWindowsDirectory Failed\n"); ok ((ret_size1 >0) && (ret_size1<256), "GetWindowsDirectory Failed\n");
ret_size = ExpandEnvironmentStringsA("%SystemRoot%",buf,sizeof(buf)); ret_size = ExpandEnvironmentStringsA("%SystemRoot%",buf,sizeof(buf));
if (ERROR_ENVVAR_NOT_FOUND == GetLastError()) if (ERROR_ENVVAR_NOT_FOUND != GetLastError())
return; {
ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf, buf1, ret_size); ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf, buf1, ret_size);
}
/* Try with a variable that references another */
SetEnvironmentVariableA("IndirectVar", "Foo%EnvVar%Bar");
strcpy(buf, "Indirect-%IndirectVar%-Indirect");
strcpy(buf2, "Indirect-Foo%EnvVar%Bar-Indirect");
ret_size = ExpandEnvironmentStringsA(buf, buf1, sizeof(buf1));
ok(ret_size == strlen(buf2)+1, "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size, strlen(buf2)+1);
ok(!strcmp(buf1, buf2), "ExpandEnvironmentStrings returned [%s]\n", buf1);
SetEnvironmentVariableA("IndirectVar", NULL);
SetEnvironmentVariableA("EnvVar", NULL); SetEnvironmentVariableA("EnvVar", NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment