changeset 6029:fc663bd5f260 release

io package: fix for Java-based BIST in JSON functions * of-io-1-fixes.patch: new file * dist-files.mk: add of-io-1-fixes.patch
author Philip Nienhuis <prnienhuis@users.sf.net>
date Sat, 01 Jan 2022 21:39:48 +0100
parents 7ac6ed5f65d0
children e2c839593e09 366839a6e6ef
files dist-files.mk src/of-io-1-fixes.patch
diffstat 2 files changed, 70 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Sat Jan 01 20:43:44 2022 +0100
+++ b/dist-files.mk	Sat Jan 01 21:39:48 2022 +0100
@@ -506,6 +506,7 @@
   of-interval-2-subsref.patch \
   of-interval-3-error_state.patch \
   of-interval.mk \
+  of-io-1-fixes.patch \
   of-io.mk \
   of-linear-algebra.mk \
   of-lssa.mk \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/of-io-1-fixes.patch	Sat Jan 01 21:39:48 2022 +0100
@@ -0,0 +1,69 @@
+# HG changeset patch
+# User Philip Nienhuis <prnienhuis@users.sf.net>
+# Date 1641061994 -3600
+#      Sat Jan 01 19:33:14 2022 +0100
+# Node ID 5a3553396bea3eeae23c1f22e6bc21e739fded11
+# Parent  4ec046f28e6dbd845c2a49693e7f6a8941157ee6
+fromJSON.m, toJSON.m: improve Java-based BIST (re-apply, bug #60040)
+
+diff -r 4ec046f28e6d -r 5a3553396bea inst/fromJSON.m
+--- a/inst/fromJSON.m	Thu Dec 30 00:00:41 2021 +0100
++++ b/inst/fromJSON.m	Sat Jan 01 19:33:14 2022 +0100
+@@ -875,12 +875,17 @@
+ %! assert(fromJSON('"@@sin"', false), '@@sin');
+ %! assert(fromJSON('"@@(x)3*x"', false),'@@(x)3*x');
+
+-%!test	##	exotic object in structure
+-%! assert( fromJSON('{"a":"[java.math.BigDecimal]"}'),struct('a','[java.math.BigDecimal]'));
++%# exotic object in structure
++%!testif HAVE_JAVA
++%! if (usejava ("jvm"))
++%!  assert(fromJSON('{"a":"[java.math.BigDecimal]"}'),struct('a','[java.math.BigDecimal]'));
++%! endif
+
+-%!test	##	exotic object (placeholder of class name)
+-%! assert( fromJSON('"[java.math.BigDecimal]"'),
+-%!         '[java.math.BigDecimal]');
++%# exotic object (placeholder of class name)
++%!testif HAVE_JAVA
++%! if (usejava ("jvm"))
++%!  assert(fromJSON('"[java.math.BigDecimal]"'),'[java.math.BigDecimal]');
++%! endif
+
+ ############### beautified or confusing JSON BIST #####################
+
+diff -r 4ec046f28e6d -r 5a3553396bea inst/toJSON.m
+--- a/inst/toJSON.m	Thu Dec 30 00:00:41 2021 +0100
++++ b/inst/toJSON.m	Sat Jan 01 19:33:14 2022 +0100
+@@ -318,9 +318,13 @@
+ %!test  ## string
+ %! assert(toJSON("abcdefg"), '"abcdefg"');
+
+-%!test  ## unknown class
+-%! obj = javaObject ("java.math.BigDecimal", 1.0);
++%# unknown class
++%!testif HAVE_JAVA
++%! if (usejava ("jvm"))
++%!  obj = javaObject ("java.math.BigDecimal", 1.0);
+ %!  assert(toJSON(obj), '"[java.math.BigDecimal]"');
++%! endif
++
+
+ %!test  ## apparent JSON string, do not quote
+ %!  assert(toJSON('[]'),'[]');
+@@ -453,9 +457,13 @@
+ %!  assert(toJSON(@sin),'"@@(x) sin(x)"')
+ %!  assert(toJSON(@(a,b)a+b+c),'"@@(a, b) a + b + c"')
+
+-%!test  ## struct with java object
+-%! obj = javaObject ("java.math.BigDecimal", 1.0);
++%# struct with java object
++%!testif HAVE_JAVA
++%! if (usejava ("jvm"))
++%!  obj = javaObject ("java.math.BigDecimal", 1.0);
+ %!  assert(toJSON(struct('a',obj)), '{"a":"[java.math.BigDecimal]"}');
++%! endif
++
+
+ %!test   ## structure array   DEFAULT COMPACT
+ %!  s = struct("a",{3.125;3.125});