File 9333-Rewrite-legacy-catch.patch of Package erlang

From 9e57f4b271109d1ceca83619992c5f570f1d9556 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Fri, 20 Feb 2026 18:17:49 +0100
Subject: [PATCH 3/4] Rewrite legacy `catch`

Rewrite the test lib macros to work better with new try .. catch.
---
 lib/tftp/test/tftp_SUITE.erl    |  99 +++++++++++++++---------------
 lib/tftp/test/tftp_test_lib.erl | 103 +++++++++++++++++++-------------
 lib/tftp/test/tftp_test_lib.hrl |  53 +++++++++-------
 3 files changed, 143 insertions(+), 112 deletions(-)

diff --git a/lib/tftp/test/tftp_SUITE.erl b/lib/tftp/test/tftp_SUITE.erl
index 213399b60a..5b14c52734 100644
--- a/lib/tftp/test/tftp_SUITE.erl
+++ b/lib/tftp/test/tftp_SUITE.erl
@@ -33,8 +33,8 @@
 
 -define(START_DAEMON(Options),
         begin
-            {ok, Pid} = ?VERIFY({ok, _Pid}, tftp:start([{port, 0} | Options])),
-            {ok, ActualOptions} = ?IGNORE(tftp:info(Pid)),
+            {{ok, Pid}} = ?VERIFY({ok, _Pid}, tftp:start([{port, 0} | Options])),
+            {{ok, ActualOptions}} = ?IGNORE(tftp:info(Pid)),
             {value, {port, ActualPort}} =
                 lists:keysearch(port, 1, ActualOptions),
             {ActualPort, Pid}
@@ -124,7 +124,7 @@ simple(suite) ->
 simple(Config) when is_list(Config) ->
     ?VERIFY(ok, application:start(tftp)),
 
-    {Port, DaemonPid} = ?IGNORE(?START_DAEMON([{debug, brief}])),
+    {{Port, DaemonPid}} = ?IGNORE(?START_DAEMON([{debug, brief}])),
 
     %% Read fail
     RemoteFilename = "tftp_temporary_remote_test_file.txt",
@@ -174,7 +174,7 @@ root_dir(Config) when is_list(Config) ->
     Blob = binary:copy(<<$1>>, 2000),
     Size = byte_size(Blob),
     ok = file:write_file(fn_jn(SideDir,Remote), Blob),
-    {Port, DaemonPid} =
+    {{Port, DaemonPid}} =
         ?IGNORE(?START_DAEMON([{debug, brief},
                                {callback,
                                 {"", tftp_file, [{root_dir, RootDir}]}}])),
@@ -226,11 +226,11 @@ extra(doc) ->
 extra(suite) ->
     [];
 extra(Config) when is_list(Config) ->
-    ?VERIFY({'EXIT', {badarg,{fake_key, fake_flag}}},
+    ?VERIFY(exit, {badarg,{fake_key, fake_flag}},
             tftp:start([{port, 0}, {fake_key, fake_flag}])),
 
-    {Port, DaemonPid} = ?IGNORE(?START_DAEMON([{debug, brief}])),
-    
+    {{Port, DaemonPid}} = ?IGNORE(?START_DAEMON([{debug, brief}])),
+
     RemoteFilename = "tftp_extra_temporary_remote_test_file.txt",
     LocalFilename = "tftp_extra_temporary_local_test_file.txt",
     Blob = <<"Some file contents\n">>,
@@ -363,19 +363,23 @@ resend_client(suite) ->
     [];
 resend_client(Config) when is_list(Config) ->
     Host = {127, 0, 0, 1},
-    {Port, DaemonPid} = ?IGNORE(?START_DAEMON([{debug, all}])),
+    {{Port, DaemonPid}} = ?IGNORE(?START_DAEMON([{debug, all}])),
 
-    ?VERIFY(ok, resend_read_client(Host, Port, 10)),
-    ?VERIFY(ok, resend_read_client(Host, Port, 512)),
-    ?VERIFY(ok, resend_read_client(Host, Port, 1025)),
+    try
 
-    ?VERIFY(ok, resend_write_client(Host, Port, 10)),
-    ?VERIFY(ok, resend_write_client(Host, Port, 512)),
-    ?VERIFY(ok, resend_write_client(Host, Port, 1025)),
-    
-    %% Cleanup
-    unlink(DaemonPid),
-    exit(DaemonPid, kill),
+    ok = resend_read_client(Host, Port, 10),
+    ok = resend_read_client(Host, Port, 512),
+    ok = resend_read_client(Host, Port, 1025),
+
+    ok = resend_write_client(Host, Port, 10),
+    ok = resend_write_client(Host, Port, 512),
+    ok = resend_write_client(Host, Port, 1025)
+
+    after
+        %% Cleanup
+        unlink(DaemonPid),
+        exit(DaemonPid, kill)
+    end,
     ok.
 
 resend_read_client(Host, Port, BlkSize) ->
@@ -393,7 +397,7 @@ resend_read_client(Host, Port, BlkSize) ->
     ?VERIFY(timeout, recv(0)),
 
     %% Open socket
-    {ok, Socket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, Socket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
 
     ReadList = [0, 1, RemoteFilename, 0, "octet", 0],
     Data1Bin = list_to_binary([0, 3, 0, 1 | Block1]),
@@ -408,7 +412,7 @@ resend_read_client(Host, Port, BlkSize) ->
                 timer:sleep(Timeout + timer:seconds(1)),
 
                 %% Recv DATA #1 (the packet that the server think that we have lost)
-                {udp, _, _, NewPort0, _} = ?VERIFY({udp, Socket, Host, _, Data1Bin}, recv(Timeout)),
+                {{udp, _, _, NewPort0, _}} = ?VERIFY({udp, Socket, Host, _, Data1Bin}, recv(Timeout)),
                 NewPort0;
             true ->
                 %% Send READ
@@ -419,7 +423,7 @@ resend_read_client(Host, Port, BlkSize) ->
 
                 %% Recv OACK
                 OptionAckBin = list_to_binary([0, 6 | Options]),
-                {udp, _, _, NewPort0, _} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
+                {{udp, _, _, NewPort0, _}} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
 
                 %% Send ACK #0
                 Ack0Bin = <<0, 4, 0, 0>>,
@@ -509,7 +513,7 @@ resend_write_client(Host, Port, BlkSize) ->
     ?VERIFY(timeout, recv(0)),
 
     %% Open socket
-    {ok, Socket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, Socket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
 
     WriteList = [0, 2, RemoteFilename, 0, "octet", 0],
     NewPort =
@@ -527,7 +531,7 @@ resend_write_client(Host, Port, BlkSize) ->
                 ?VERIFY({udp, Socket, Host, _, Ack0Bin}, recv(Timeout)),
 
                 %% Recv ACK #0  AGAIN (the re-sent package)
-                {udp, _, _, NewPort0, _} = ?VERIFY({udp, Socket, Host, _, Ack0Bin}, recv(Timeout)),
+                {{udp, _, _, NewPort0, _}} = ?VERIFY({udp, Socket, Host, _, Ack0Bin}, recv(Timeout)),
                 NewPort0;
             true ->
                 %% Send WRITE
@@ -543,7 +547,7 @@ resend_write_client(Host, Port, BlkSize) ->
                 ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
                 
                 %% Recv OACK AGAIN (the re-sent package)
-                {udp, _, _, NewPort0, _} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
+                {{udp, _, _, NewPort0, _}} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
                 NewPort0
         end,
 
@@ -616,14 +620,13 @@ resend_server(suite) ->
 resend_server(Config) when is_list(Config) ->
     Host = {127, 0, 0, 1},
 
-    ?VERIFY(ok, resend_read_server(Host, 10)),
-    ?VERIFY(ok, resend_read_server(Host, 512)),
-    ?VERIFY(ok, resend_read_server(Host, 1025)),
-    
-    ?VERIFY(ok, resend_write_server(Host, 10)),
-    ?VERIFY(ok, resend_write_server(Host, 512)),
-    ?VERIFY(ok, resend_write_server(Host, 1025)),
-    ok.
+    ok = resend_read_server(Host, 10),
+    ok = resend_read_server(Host, 512),
+    ok = resend_read_server(Host, 1025),
+
+    ok = resend_write_server(Host, 10),
+    ok = resend_write_server(Host, 512),
+    ok = resend_write_server(Host, 1025).
 
 resend_read_server(Host, BlkSize) ->
     RemoteFilename = "tftp_resend_read_server.tmp",
@@ -640,11 +643,11 @@ resend_read_server(Host, BlkSize) ->
     ?VERIFY(timeout, recv(0)),
 
     %% Open daemon socket
-    {ok, DaemonSocket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
-    {ok, DaemonPort} = ?IGNORE(inet:port(DaemonSocket)),
+    {{ok, DaemonSocket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, DaemonPort}} = ?IGNORE(inet:port(DaemonSocket)),
 
     %% Open server socket
-    {ok, ServerSocket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, ServerSocket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
     ?IGNORE(inet:port(ServerSocket)),
 
     %% Prepare client process
@@ -652,7 +655,7 @@ resend_read_server(Host, BlkSize) ->
     ClientFun =
         fun(Extra) ->
                 Options = [{port, DaemonPort}, {debug, brief}] ++ Extra,
-                Res = ?VERIFY({ok, Blob}, tftp:read_file(RemoteFilename, binary, Options)),
+                {Res} = ?VERIFY({ok, Blob}, tftp:read_file(RemoteFilename, binary, Options)),
                 ReplyTo ! {self(), {tftp_client_reply, Res}},
                 exit(normal)
         end,
@@ -668,7 +671,7 @@ resend_read_server(Host, BlkSize) ->
 
                 %% Recv READ
                 ReadBin = list_to_binary(ReadList),
-                {udp, _, _, ClientPort0, _} = ?VERIFY({udp, DaemonSocket, Host, _, ReadBin}, recv(Timeout)),
+                {{udp, _, _, ClientPort0, _}} = ?VERIFY({udp, DaemonSocket, Host, _, ReadBin}, recv(Timeout)),
 
                 %% Send DATA #1
                 ?VERIFY(ok,  gen_udp:send(ServerSocket, Host, ClientPort0, Data1Bin)),
@@ -690,7 +693,7 @@ resend_read_server(Host, BlkSize) ->
                 %% Recv READ
                 Options = ["blksize", 0, BlkSizeList, 0],
                 ReadBin = list_to_binary([ReadList | Options]),
-                {udp, _, _, ClientPort0, _} = ?VERIFY({udp, DaemonSocket, Host, _, ReadBin}, recv(Timeout)),
+                {{udp, _, _, ClientPort0, _}} = ?VERIFY({udp, DaemonSocket, Host, _, ReadBin}, recv(Timeout)),
 
                 %% Send OACK
                 BlkSizeList = integer_to_list(BlkSize),
@@ -791,11 +794,11 @@ resend_write_server(Host, BlkSize) ->
     ?VERIFY(timeout, recv(0)),
 
     %% Open daemon socket
-    {ok, DaemonSocket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
-    {ok, DaemonPort} = ?IGNORE(inet:port(DaemonSocket)),
+    {{ok, DaemonSocket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, DaemonPort}} = ?IGNORE(inet:port(DaemonSocket)),
 
     %% Open server socket
-    {ok, ServerSocket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, ServerSocket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
     ?IGNORE(inet:port(ServerSocket)),
 
     %% Prepare client process
@@ -803,7 +806,7 @@ resend_write_server(Host, BlkSize) ->
     ClientFun =
         fun(Extra) ->
                 Options = [{port, DaemonPort}, {debug, brief}] ++ Extra,
-                Res = ?VERIFY({ok, Size}, tftp:write_file(RemoteFilename, Blob, Options)),
+                {Res} = ?VERIFY({ok, Size}, tftp:write_file(RemoteFilename, Blob, Options)),
                 ReplyTo ! {self(), {tftp_client_reply, Res}},
                 exit(normal)
         end,
@@ -819,7 +822,7 @@ resend_write_server(Host, BlkSize) ->
                 %% Recv WRITE
                 WriteBin = list_to_binary(WriteList),
                 io:format("WriteBin ~p\n", [WriteBin]),
-                {udp, _, _, ClientPort0, _} = ?VERIFY({udp, DaemonSocket, Host, _, WriteBin}, recv(Timeout)),
+                {{udp, _, _, ClientPort0, _}} = ?VERIFY({udp, DaemonSocket, Host, _, WriteBin}, recv(Timeout)),
 
                 %% Send ACK #1
                 Ack0Bin = <<0, 4, 0, 0>>,
@@ -842,7 +845,7 @@ resend_write_server(Host, BlkSize) ->
                 %% Recv WRITE
                 Options = ["blksize", 0, BlkSizeList, 0],
                 WriteBin = list_to_binary([WriteList | Options]),
-                {udp, _, _, ClientPort0, _} = ?VERIFY({udp, DaemonSocket, Host, _, WriteBin}, recv(Timeout)),
+                {{udp, _, _, ClientPort0, _}} = ?VERIFY({udp, DaemonSocket, Host, _, WriteBin}, recv(Timeout)),
 
                 %% Send OACK
                 BlkSizeList = integer_to_list(BlkSize),
@@ -932,7 +935,7 @@ reuse_connection(suite) ->
     [];
 reuse_connection(Config) when is_list(Config) ->
     Host = {127, 0, 0, 1},
-    {Port, DaemonPid} = ?IGNORE(?START_DAEMON([{debug, all}])),
+    {{Port, DaemonPid}} = ?IGNORE(?START_DAEMON([{debug, all}])),
 
     RemoteFilename = "reuse_connection.tmp",
     BlkSize = 512,
@@ -947,7 +950,7 @@ reuse_connection(Config) when is_list(Config) ->
     ?VERIFY(timeout, recv(0)),
     
     %% Open socket
-    {ok, Socket} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
+    {{ok, Socket}} = ?VERIFY({ok, _}, gen_udp:open(0, [binary, {reuseaddr, true}, {active, true}])),
     
     ReadList = [0, 1, RemoteFilename, 0, "octet", 0],
     Data1Bin = list_to_binary([0, 3, 0, 1 | Block1]),
@@ -963,7 +966,7 @@ reuse_connection(Config) when is_list(Config) ->
 
     %% Recv OACK
     OptionAckBin = list_to_binary([0, 6 | Options]),
-    {udp, _, _, NewPort, _} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
+    {{udp, _, _, NewPort, _}} = ?VERIFY({udp, Socket, Host, _, OptionAckBin}, recv(Timeout)),
 
     %% Send ACK #0
     Ack0Bin = <<0, 4, 0, 0>>,
@@ -1006,7 +1009,7 @@ large_file(suite) ->
 large_file(Config) when is_list(Config) ->
     ?VERIFY(ok, application:start(tftp)),
 
-    {Port, DaemonPid} = ?IGNORE(?START_DAEMON([{debug, brief}])),
+    {{Port, DaemonPid}} = ?IGNORE(?START_DAEMON([{debug, brief}])),
 
     %% Read fail
     RemoteFilename = "tftp_temporary_large_file_remote_test_file.txt",
diff --git a/lib/tftp/test/tftp_test_lib.erl b/lib/tftp/test/tftp_test_lib.erl
index aac6505073..f1913960ef 100644
--- a/lib/tftp/test/tftp_test_lib.erl
+++ b/lib/tftp/test/tftp_test_lib.erl
@@ -31,7 +31,7 @@
 
 -module(tftp_test_lib).
 
--compile(export_all).
+-compile([export_all, nowarn_export_all]).
 
 -include("tftp_test_lib.hrl").
 
@@ -42,11 +42,11 @@
 
 init_per_testcase(_Case, Config) when is_list(Config) ->
     io:format("\n ", []),
-    ?IGNORE(application:stop(tftp)),   
+    ?IGNORE(application:stop(tftp)),
     Config.
 
 end_per_testcase(_Case, Config) when is_list(Config) ->
-    ?IGNORE(application:stop(tftp)),   
+    ?IGNORE(application:stop(tftp)),
     Config.
 
 
@@ -54,30 +54,51 @@ end_per_testcase(_Case, Config) when is_list(Config) ->
 %% Infrastructure for test suite
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+verify(MatchFun, Fun, Mod, Line) ->
+    try Fun() of
+        Result ->
+            case MatchFun({Result}) of
+                true ->
+                    log("Ok, ~p~n", [Result], Mod, Line),
+                    {Result};
+                false ->
+                    log("<ERROR> Bad result: ~p\n", [Result], Mod, Line),
+                    erlang:error({Mod, Line, Result})
+            end
+    catch Class : Reason : Stacktrace ->
+            case MatchFun({Class, Reason}) of
+                true ->
+                    log("Expected exception, ~w : ~w : ~p~n",
+                        [Class, Reason, Stacktrace],
+                        Mod, Line),
+                    {Class, Reason, Stacktrace};
+                false ->
+                    log("Exception, ~w : ~w : ~p~n",
+                        [Class, Reason, Stacktrace],
+                        Mod, Line),
+                    erlang:error({Mod, Line, Class, Reason, Stacktrace})
+            end
+    end.
+
+ignore(Fun, Mod, Line) ->
+    try Fun() of
+        Result ->
+            log("Ok, ~p~n", [Result], Mod, Line),
+            {Result}
+    catch Class : Reason : Stacktrace ->
+            log("Ignored exception, ~w : ~w : ~p~n",
+                [Class, Reason, Stacktrace],
+                Mod, Line),
+            {Class, Reason, Stacktrace}
+    end.
+
 error(Actual, Mod, Line) ->
-    (catch global:send(tftp_global_logger, {failed, Mod, Line})),
     log("<ERROR> Bad result: ~p\n", [Actual], Mod, Line),
-    Label = lists:concat([Mod, "(", Line, ") unexpected result"]),
-    report_event(60, Mod, Mod, Label,
-                 [{line, Mod, Line}, {error, Actual}]),
-    case global:whereis_name(tftp_test_case_sup) of
-	undefined -> 
-	    ignore;
-	Pid -> 
-	    Fail = #'REASON'{mod = Mod, line = Line, desc = Actual},
-	    Pid ! {fail, self(), Fail}
-    end,
-    Actual.
+    erlang:error({Mod, Line, Actual}).
 
 log(Format, Args, Mod, Line) ->
-    case global:whereis_name(tftp_global_logger) of
-	undefined ->
-	    io:format(user, "~p(~p): " ++ Format, 
-		      [Mod, Line] ++ Args);
-	Pid ->
-	    io:format(Pid, "~p(~p): " ++ Format, 
-		      [Mod, Line] ++ Args)
-    end.
+    io:format(user, "~p(~p): " ++ Format, [Mod, Line] ++ Args).
+
 
 default_config() ->
     [].
@@ -96,7 +117,7 @@ t(Cases, Config) ->
     Res.
 
 do_test({Mod, Fun}, Config) when is_atom(Mod), is_atom(Fun) ->
-    case catch apply(Mod, Fun, [suite]) of
+    try apply(Mod, Fun, [suite]) of
 	[] ->
 	    io:format("Eval:   ~p:", [{Mod, Fun}]),
 	    Res = eval(Mod, Fun, Config),
@@ -112,32 +133,32 @@ do_test({Mod, Fun}, Config) when is_atom(Mod), is_atom(Fun) ->
 	    do_test(lists:map(Map, Cases), Config);
 
         {req, _, {conf, Init, Cases, Finish}} ->
-	    case (catch apply(Mod, Init, [Config])) of
+	    try apply(Mod, Init, [Config]) of
 		Conf when is_list(Conf) ->
 		    io:format("Expand: ~p ...\n", [{Mod, Fun}]),
 		    Map = fun(Case) when is_atom(Case)-> {Mod, Case};
 			     (Case) -> Case
 			  end,
 		    Res = do_test(lists:map(Map, Cases), Conf),
-		    (catch apply(Mod, Finish, [Conf])),
+		    try apply(Mod, Finish, [Conf]) catch _ : _ -> ok end,
 		    Res;
-		    
-		{'EXIT', {skipped, Reason}} ->
-		    io:format(" => skipping: ~p\n", [Reason]),
-		    [{skipped, {Mod, Fun}, Reason}];
-		    
+
 		Error ->
 		    io:format(" => failed: ~p\n", [Error]),
 		    [{failed, {Mod, Fun}, Error}]
-	    end;
-		    
-        {'EXIT', {undef, _}} ->
-	    io:format("Undefined:   ~p\n", [{Mod, Fun}]),
-	    [{nyi, {Mod, Fun}, ok}];
-		    
+
+            catch throw : {skipped, Reason} ->
+		    io:format(" => skipping: ~p\n", [Reason]),
+		    [{skipped, {Mod, Fun}, Reason}]
+            end;
+
         Error ->
 	    io:format("Ignoring:   ~p: ~p\n", [{Mod, Fun}, Error]),
 	    [{failed, {Mod, Fun}, Error}]
+
+    catch error : undef : Stacktrace ->
+	    io:format("Undefined:   ~p~n~p~n", [{Mod, Fun}, Stacktrace]),
+	    [{nyi, {Mod, Fun}, ok}]
     end;
 do_test(Mod, Config) when is_atom(Mod) ->
     Res = do_test({Mod, all}, Config),
@@ -191,11 +212,11 @@ wait_for_evaluator(Pid, Mod, Fun, Config, Errors) ->
     end.
 
 do_eval(ReplyTo, Mod, Fun, Config) ->
-    case (catch apply(Mod, Fun, [Config])) of
-	{'EXIT', {skipped, Reason}} ->
-	    ReplyTo ! {'EXIT', self(), {skipped, Reason}};
+    try apply(Mod, Fun, [Config]) of
 	Other ->
 	    ReplyTo ! {done, self(), Other}
+    catch throw : {skipped, Reason} ->
+	    ReplyTo ! {'EXIT', self(), {skipped, Reason}}
     end,
     unlink(ReplyTo),
     exit(shutdown).
diff --git a/lib/tftp/test/tftp_test_lib.hrl b/lib/tftp/test/tftp_test_lib.hrl
index 3b57e8f09e..727838df8d 100644
--- a/lib/tftp/test/tftp_test_lib.hrl
+++ b/lib/tftp/test/tftp_test_lib.hrl
@@ -20,28 +20,35 @@
 %% %CopyrightEnd%
 %%
 
--record('REASON', {mod, line, desc}).
-
--define(LOG(Format, Args),
-	tftp_test_lib:log(Format, Args, ?MODULE, ?LINE)).
-
--define(ERROR(Reason),
-        erlang:error({?MODULE,?LINE,?FUNCTION_NAME,(Reason)})).
-	%% tftp_test_lib:error(Reason, ?MODULE, ?LINE)).
-
 -define(VERIFY(Expected, Expr),
-	fun() ->
-		AcTuAlReS = (catch (Expr)),
-		case AcTuAlReS of
-		    Expected -> ?LOG("Ok, ~p\n", [AcTuAlReS]);
-		    _        ->	?ERROR(AcTuAlReS)
-	       end,
-		AcTuAlReS
-	end()).
+        begin
+            tftp_test_lib:verify(
+              fun (_ExPr_ReSuLt) ->
+                      case _ExPr_ReSuLt of
+                          {Expected} -> true;
+                          _          -> false
+                      end
+              end,
+              fun () -> begin Expr end end,
+              ?MODULE, ?LINE)
+        end).
+
+-define(VERIFY(Class, Reason, Expr),
+        begin
+            tftp_test_lib:verify(
+              fun (_ExCePtIoN_TuPlE) ->
+                      case _ExCePtIoN_TuPlE of
+                          {(Class), (Reason)} -> true;
+                          _                   -> false
+                      end
+              end,
+              fun () -> begin Expr end end,
+              ?MODULE, ?LINE)
+        end).
 
--define(IGNORE(Expr), 
-	fun() ->
-		AcTuAlReS = (catch (Expr)),
-		?LOG("Ok, ~p\n", [AcTuAlReS]),
-		AcTuAlReS
-	end()).
+-define(IGNORE(Expr),
+        begin
+            tftp_test_lib:ignore(
+              fun () -> begin Expr end end,
+              ?MODULE, ?LINE)
+        end).
-- 
2.51.0

openSUSE Build Service is sponsored by