[Patch] Clean obsolete functions() from assert.m
Thomas Weber
thomas.weber.mail at gmail.com
Sun Nov 30 12:30:14 CST 2008
Hi,
I stumbled across this when checking the bioinfo package. Using 3.1.51:
octave3.1:1> test assert
warning: struct_elements is obsolete and will be removed from a future version of Octave; please use fieldnames instead
warning: struct_contains is obsolete and will be removed from a future version of Octave; please use isfield instead
PASSES 55 out of 55 tests
Patch attached.
Thomas
-------------- next part --------------
# HG changeset patch
# User Thomas Weber <thomas.weber.mail at gmail.com>
# Date 1228063930 -3600
# Node ID 4fc1023c13b56de5f3c19405fa6213bde92569c1
# Parent 03b414516dd8e72ed1a326a65e1346572696c187
Replace deprecated struct_elements/struct_contains by fieldnames/isfield, respectively
diff --git a/scripts/testfun/assert.m b/scripts/testfun/assert.m
--- a/scripts/testfun/assert.m
+++ b/scripts/testfun/assert.m
@@ -110,14 +110,14 @@
elseif (isstruct (expected))
if (! isstruct (cond) || any (size (cond) != size (expected))
- || rows(struct_elements (cond)) != rows (struct_elements (expected)))
+ || rows(fieldnames (cond)) != rows (fieldnames (expected)))
iserror = 1;
else
try
empty = numel (cond) == 0;
normal = numel (cond) == 1;
for [v, k] = cond
- if (! struct_contains (expected, k))
+ if (! isfield (expected, k))
error ();
endif
if (empty)
More information about the Octave-maintainers
mailing list