2011/6/15 Frédéric Delanoy frederic.delanoy@gmail.com:
- if(err == out_nl) {
- if (!is_todo_wine)
- ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
- line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
- else
- todo_wine
- ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
- line, (int)(out_nl-out_ptr), out_ptr,
- (int)(exp_nl-exp_ptr-sizeof(todo_wine_cmd)), exp_ptr+sizeof(todo_wine_cmd));
- }else if(err) {
- if (!is_todo_wine)
- ok(0, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
- *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr),
- out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
- else
- todo_wine
- ok(0, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
- *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr), out_ptr,
- (int)(exp_nl-exp_ptr-sizeof(todo_wine_cmd)), exp_ptr+sizeof(todo_wine_cmd));
- }else {
- if(is_todo_wine)
- todo_wine ok(TRUE, "match at line %d\n", line);
- }
Hello,
I think Jacek was suggesting something among these lines, which does look prettier imho (replace quoted text with following):
+ if(err == out_nl) { + if (!is_todo_wine) + ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n", + line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr); + else + todo_wine + ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n", + line, (int)(out_nl-out_ptr), out_ptr, + (int)(exp_nl-exp_ptr-sizeof(todo_wine_cmd)), exp_ptr+sizeof(todo_wine_cmd)); + }else { + if (!is_todo_wine) + ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n", + *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr), + out_ptr, (int)(exp_nl-exp_ptr), exp_ptr); + else + todo_wine + ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n", + *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr), out_ptr, + (int)(exp_nl-exp_ptr-sizeof(todo_wine_cmd)), exp_ptr+sizeof(todo_wine_cmd)); + }
There is also another difference from your code: the code above also counts the succeeded tests, whereas your code doesn't.
Octavian
On Thu, Jun 16, 2011 at 02:24, Octavian Voicu octavian.voicu@gmail.com wrote:
Hello,
I think Jacek was suggesting something among these lines, which does look prettier imho (replace quoted text with following): ...
- }else {
- if (!is_todo_wine)
- ok(!err, "unexpected char 0x%x position %d in line %d
(got '%.*s', wanted '%.*s')\n",
- *err, (int)(err-out_ptr), line, (int)(out_nl-out_ptr),
- out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
- else
- todo_wine
- ok(!err, "unexpected char 0x%x position %d in line %d
(got '%.*s', wanted '%.*s')\n",
- *err, (int)(err-out_ptr), line,
(int)(out_nl-out_ptr), out_ptr,
- (int)(exp_nl-exp_ptr-sizeof(todo_wine_cmd)),
exp_ptr+sizeof(todo_wine_cmd));
- }
There is also another difference from your code: the code above also counts the succeeded tests, whereas your code doesn't.
Yes, except err is dereferenced in ok arguments so this doesn't work I discussed with jacek on irc: you could remove the ok(!err, ...) and use sthg like (err ? *err : 0) instead of the *err but you then get a problem for "tests succeeded in todo block" to report the correct char and position in the error message. Also, jacek didn't particularly care about the # of tests reported executed, as long as all tests are run and errors are reported correctly, so tbe ok(TRUE,...) was removed.
Frédéric