Skip to content

Commit 4473a88

Browse files
committed
fix: update variable types in ExpressionParserTest for consistency in addition tests
1 parent 362c131 commit 4473a88

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/mindustrytool/workflow/expressions/ExpressionParser.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ public <T> T evaluate(Class<T> type, String expr, Map<String, Object> variables)
216216
} else if (WorkflowNode.VARIABLE_PATTERN.matcher(token).matches()) {
217217
var variableName = token.replace("{{", "").replace("}}", "").trim();
218218
var variable = consume(variableName, variables);
219-
stack.push(variable);
219+
if (variable instanceof Number number) {
220+
stack.push(number.doubleValue());
221+
} else {
222+
stack.push(variable);
223+
}
220224
Log.debug("Add variable: " + variableName);
221225
} else {
222226
try {

src/test/java/ExpressionParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class ExpressionParserTest {
1010
ExpressionParser parser = new ExpressionParser();
1111

12-
Map<String, Object> variables = Map.of("a", 1, "b", 2);
12+
Map<String, Object> variables = Map.of("a", 1d, "b", 2d);
1313

1414
@Test
1515
void testAddition() {

0 commit comments

Comments
 (0)