]> sigrok.org Git - libsigrok.git/commit
tests: Replace deprecated fail(_unless) calls
authorJ. Neuschäfer <redacted>
Tue, 13 May 2025 20:30:49 +0000 (22:30 +0200)
committerSoeren Apel <redacted>
Sun, 9 Nov 2025 21:39:18 +0000 (22:39 +0100)
commitcd4952994edd6df4a4dceda0be11dac88bfca94b
tree634eeeaf9ba222022d3823e247ef27683caf1b82
parent3406d6711299d9f2527561f85b1b0ff7cac7fb32
tests: Replace deprecated fail(_unless) calls

A new API (ck_assert) to replace fail_* was introduced in check
0.9.6 (released in 2008), and fail_* has been deprecated since at least
0.9.10 (released in 2013).

This patch was automated with coccinelle:

  spatch --sp-file patch.coc --in-place tests/*.c

@@
expression msg;
@@
 <...
- fail(msg);
+ ck_abort_msg(msg);
  ...>

@@
expression msg, arg1;
@@
 <...
- fail(msg, arg1);
+ ck_abort_msg(msg, arg1);
  ...>

@@
expression msg, arg1, arg2;
@@
 <...
- fail(msg, arg1, arg2);
+ ck_abort_msg(msg, arg1, arg2);
  ...>

@@
expression expr;
@@

  <...
- fail_unless(expr);
+ ck_assert(expr);
  ...>

@@
expression expr, msg;
@@

  <...
- fail_unless(expr, msg);
+ ck_assert_msg(expr, msg);
  ...>

@@
expression expr, msg, arg1;
@@

  <...
- fail_unless(expr, msg, arg1);
+ ck_assert_msg(expr, msg, arg1);
  ...>

@@
expression expr, msg, arg1, arg2;
@@

  <...
- fail_unless(expr, msg, arg1, arg2);
+ ck_assert_msg(expr, msg, arg1, arg2);
  ...>

@@
expression expr, msg, arg1, arg2, arg3;
@@

  <...
- fail_unless(expr, msg, arg1, arg2, arg3);
+ ck_assert_msg(expr, msg, arg1, arg2, arg3);
  ...>

@@
expression expr, msg, arg1, arg2, arg3, arg4;
@@

  <...
- fail_unless(expr, msg, arg1, arg2, arg3, arg4);
+ ck_assert_msg(expr, msg, arg1, arg2, arg3, arg4);
  ...>

@@
expression expr, msg, arg1, arg2, arg3, arg4, arg5;
@@

  <...
- fail_unless(expr, msg, arg1, arg2, arg3, arg4, arg5);
+ ck_assert_msg(expr, msg, arg1, arg2, arg3, arg4, arg5);
  ...>
14 files changed:
tests/analog.c
tests/conv.c
tests/core.c
tests/device.c
tests/driver_all.c
tests/input_all.c
tests/input_binary.c
tests/lib.c
tests/output_all.c
tests/session.c
tests/strutil.c
tests/transform_all.c
tests/trigger.c
tests/version.c