Commit e486a021 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

cmd: Added @or_broken@ handling to test templates and use it to fix tests on win2k.

parent e7615e00
......@@ -101,9 +101,11 @@ static const char *compare_line(const char *out_line, const char *out_end, const
const char *exp_end)
{
const char *out_ptr = out_line, *exp_ptr = exp_line;
const char *err = NULL;
static const char pwd_cmd[] = {'@','p','w','d','@'};
static const char todo_space_cmd[] = {'@','t','o','d','o','_','s','p','a','c','e','@'};
static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
while(exp_ptr < exp_end) {
if(*exp_ptr == '@') {
......@@ -112,10 +114,12 @@ static const char *compare_line(const char *out_line, const char *out_end, const
exp_ptr += sizeof(pwd_cmd);
if(out_end-out_ptr < workdir_len
|| (CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, out_ptr, workdir_len,
workdir, workdir_len) != CSTR_EQUAL))
return out_ptr;
workdir, workdir_len) != CSTR_EQUAL)) {
err = out_ptr;
}else {
out_ptr += workdir_len;
continue;
}
}else if(exp_ptr+sizeof(todo_space_cmd) <= exp_end
&& !memcmp(exp_ptr, todo_space_cmd, sizeof(todo_space_cmd))) {
exp_ptr += sizeof(todo_space_cmd);
......@@ -123,10 +127,31 @@ static const char *compare_line(const char *out_line, const char *out_end, const
if(out_ptr < out_end && *out_ptr == ' ')
out_ptr++;
continue;
}else if(exp_ptr+sizeof(or_broken_cmd) <= exp_end
&& !memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd))) {
exp_ptr = exp_end;
continue;
}
}else if(out_ptr == out_end || *out_ptr != *exp_ptr) {
err = out_ptr;
}
if(err) {
if(!broken(1))
return err;
while(exp_ptr+sizeof(or_broken_cmd) <= exp_end && memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd)))
exp_ptr++;
if(!exp_ptr)
return err;
exp_ptr += sizeof(or_broken_cmd);
out_ptr = out_line;
err = NULL;
continue;
}
if(out_ptr == out_end || *out_ptr != *exp_ptr++)
return out_ptr;
exp_ptr++;
out_ptr++;
}
......
......@@ -23,6 +23,7 @@ cd dummydir
echo %~dp0
cd ..
rmdir dummydir
echo CD value %CD%
echo %%
echo P%
echo %P
......
......@@ -16,6 +16,7 @@ bar
~dp0 should be directory containing batch file
@pwd@\
@pwd@\
CD value @pwd@@or_broken@CD value
%
P
P
......
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