From 0987f67fc9add3b8609f11acb8d0df218bf30c66 Mon Sep 17 00:00:00 2001 From: A Samuel Pottinger Date: Wed, 10 May 2023 14:01:46 +0000 Subject: [PATCH] Clarify unneeded section. --- java/src/processing/mode/java/debug/VariableNode.java | 2 +- .../processing/mode/java/debug/VariableNodeTests.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/src/processing/mode/java/debug/VariableNode.java b/java/src/processing/mode/java/debug/VariableNode.java index 9b8c418de..7056854b2 100644 --- a/java/src/processing/mode/java/debug/VariableNode.java +++ b/java/src/processing/mode/java/debug/VariableNode.java @@ -56,7 +56,7 @@ public class VariableNode implements MutableTreeNode { public static final int TYPE_VOID = 11; private static final Pattern ARRAY_REGEX = Pattern.compile( - "^(?[^\\]]+)(?(\\[\\])*)(?(\\[\\d+\\])+).*$" + "^(?[^\\[]+)(?(\\[\\])*)(?(\\[\\d+\\])+)(?[^\\[]*)$" ); protected String type; diff --git a/java/test/processing/mode/java/debug/VariableNodeTests.java b/java/test/processing/mode/java/debug/VariableNodeTests.java index 9b5530ffd..427f90215 100644 --- a/java/test/processing/mode/java/debug/VariableNodeTests.java +++ b/java/test/processing/mode/java/debug/VariableNodeTests.java @@ -74,9 +74,16 @@ public class VariableNodeTests { @Test public void describeArrayFailsafe() { - Value value = buildMockValue("instance of int[x][7] (id=998)"); + Value value = buildMockValue("instance of int[x][7] (id=98)"); VariableNode node = new VariableNode("test", "int[][][][]", value); - Assert.assertEquals(node.getStringValue(), "instance of int[x][7] (id=998)); + Assert.assertEquals(node.getStringValue(), "instance of int[x][7] (id=98)"); + } + + @Test + public void describeArrayUnexpectedOrder() { + Value value = buildMockValue("instance of int[7][] (id=98)"); + VariableNode node = new VariableNode("test", "int[][][][]", value); + Assert.assertEquals(node.getStringValue(), "instance of int[7][] (id=98)"); } private Value buildMockValue(String toStringValue) {