From 733f51e0c4e8b00e19b6be630bb6f4a4f25ce0dc Mon Sep 17 00:00:00 2001 From: kirjorjos Date: Sat, 14 Dec 2024 08:34:40 -0500 Subject: [PATCH] Added tests for error operator and fixed indentation in lang/en_us.json --- .../assets/integrateddynamics/lang/en_us.json | 4 ++-- .../evaluate/variable/TestStringOperators.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/integrateddynamics/lang/en_us.json b/src/main/resources/assets/integrateddynamics/lang/en_us.json index dcc082f259c..ffd1db98fcc 100644 --- a/src/main/resources/assets/integrateddynamics/lang/en_us.json +++ b/src/main/resources/assets/integrateddynamics/lang/en_us.json @@ -1060,8 +1060,8 @@ "operator.integrateddynamics.string.name.info": "Get the string or name of a named object or converts it to a string", "operator.integrateddynamics.string.unique_name": "Unique Name", "operator.integrateddynamics.string.unique_name.info": "Get the unique name of an object", - "operator.integrateddynamics.string.string_error": "Error", - "operator.integrateddynamics.string.string_error.info": "Throw a custom error", + "operator.integrateddynamics.string.string_error": "Error", + "operator.integrateddynamics.string.string_error.info": "Throw a custom error", "operator.integrateddynamics.double": "Double", "operator.integrateddynamics.double.basename": "Double %s", diff --git a/src/test/java/org/cyclops/integrateddynamics/core/evaluate/variable/TestStringOperators.java b/src/test/java/org/cyclops/integrateddynamics/core/evaluate/variable/TestStringOperators.java index 7ebccfdc1bf..0dc42c141d9 100644 --- a/src/test/java/org/cyclops/integrateddynamics/core/evaluate/variable/TestStringOperators.java +++ b/src/test/java/org/cyclops/integrateddynamics/core/evaluate/variable/TestStringOperators.java @@ -780,4 +780,18 @@ public void testInvalidInputTypeNamedName() throws EvaluationException { Operators.NAMED_NAME.evaluate(new IVariable[]{DUMMY_VARIABLE}); } + /** + * ----------------------------------- STRING_ERROR ----------------------------------- + */ + + @Test(expected = EvaluationException.class) + public void testSymbolsError() throws EvaluationException { + Operators.STRING_ERROR.evaluate(sregex); + } + + @Test(expected = EvaluationException.class) + public void testSpacesError() throws EvaluationException { + Operators.STRING_ERROR.evaluate(shelloWorld); + } + }