File 2531-stdlib-Improve-the-erl_pp-module-s-debug-tests.patch of Package erlang

From a65c5dddda4a7d54f972be8412de2b37aabf6584 Mon Sep 17 00:00:00 2001
From: Hans Bolinder <hasse@erlang.org>
Date: Mon, 13 Feb 2017 13:28:39 +0100
Subject: [PATCH 01/15] stdlib: Improve the  erl_pp module's debug tests

---
 lib/stdlib/src/erl_pp.erl | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index d30cd508c..6068afb29 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -51,6 +51,15 @@
 %-define(DEBUG, true).
 
 -ifdef(DEBUG).
+-define(FORM_TEST(T),
+        _ = case T of
+                {eof, _Line} -> ok;
+                {warning, _W} -> ok;
+                {error, _E} -> ok;
+                _ -> ?TEST(T)
+            end).
+-define(EXPRS_TEST(L),
+        [?TEST(E) || E <- L]).
 -define(TEST(T),
         %% Assumes that erl_anno has been compiled with DEBUG=true.
         %% erl_pp does not use the annoations, but test it anyway.
@@ -62,6 +71,8 @@
                     erlang:error(badarg, [T])
             end).
 -else.
+-define(FORM_TEST(T), ok).
+-define(EXPRS_TEST(T), ok).
 -define(TEST(T), ok).
 -endif.
 
@@ -80,7 +91,7 @@ form(Thing) ->
       Options :: options()).
 
 form(Thing, Options) ->
-    ?TEST(Thing),
+    ?FORM_TEST(Thing),
     State = state(Options),
     frmt(lform(Thing, options(Options)), State).
 
@@ -124,7 +135,7 @@ guard(Gs) ->
       Options :: options()).
 
 guard(Gs, Options) ->
-    ?TEST(Gs),
+    ?EXPRS_TEST(Gs),
     frmt(lguard(Gs, options(Options)), state(Options)).
 
 -spec(exprs(Expressions) -> io_lib:chars() when
@@ -146,7 +157,7 @@ exprs(Es, Options) ->
       Options :: options()).
 
 exprs(Es, I, Options) ->
-    ?TEST(Es),
+    ?EXPRS_TEST(Es),
     frmt({seq,[],[],[$,],lexprs(Es, options(Options))}, I, state(Options)).
 
 -spec(expr(Expression) -> io_lib:chars() when
-- 
2.12.0

openSUSE Build Service is sponsored by