[2/3] cmd/tests: Add support for todo_wine constructions (try 3)

Octavian Voicu octavian.voicu at gmail.com
Wed Jun 15 19:24:15 CDT 2011


2011/6/15 Frédéric Delanoy <frederic.delanoy at 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



More information about the wine-devel mailing list