From 85f3dbbe718d06e789da7c01c44f66ce824e9fc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 15 Apr 2022 15:44:36 +0200
Subject: [PATCH] Testsuite: suppress spurious warnings under Octave 7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In this version of Octave, “warning on” really enables all warnings (while this
was not the case in Octave 6, suprisingly; I think this used to be different
with even older Octave releases).
---
 src/@dseries/subsref.m | 6 +++---
 tests/runalltests.m    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/@dseries/subsref.m b/src/@dseries/subsref.m
index 1b8a4fb..b5c101b 100644
--- a/src/@dseries/subsref.m
+++ b/src/@dseries/subsref.m
@@ -15,7 +15,7 @@ function r = subsref(o, S) % --*-- Unitary tests --*--
 %                     by applying a public method on `o`, or a dseries object built by extracting
 %                     a variable from `o`, or a dseries object containing a subsample.
 
-% Copyright © 2011-2021 Dynare Team
+% Copyright © 2011-2022 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -488,9 +488,9 @@ return
      t(2) = 0;
  end
  try
-     warning off all
+     warnstate = warning('off');
      c = ts1{'[A-Z]_1'};
-     warning on all
+     warning(warnstate);
      t(3) = 0;
  catch
      t(3) = 1;
diff --git a/tests/runalltests.m b/tests/runalltests.m
index 107be58..d29ab02 100644
--- a/tests/runalltests.m
+++ b/tests/runalltests.m
@@ -1,6 +1,6 @@
 function runalltests()
 
-% Copyright © 2015-2019 Dynare Team
+% Copyright © 2015-2022 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ catch
     initialize_dseries_class();
 end
 
-warning off
+warnstate = warning('off');
 
 if isoctave()
     if ~user_has_octave_forge_package('io')
@@ -60,7 +60,7 @@ else
     system('touch pass');
 end
 
-warning on
+warning(warnstate);
 path(opath);
 
 display_report(r);
-- 
GitLab