From 01d75003ce04975feb8d77045aae012567143c65 Mon Sep 17 00:00:00 2001 From: Rafael Bey Date: Tue, 19 Nov 2024 14:08:05 -0500 Subject: [PATCH] Fix parser fixer test --- .../legend/engine/repl/autocomplete/parser/ParserFixer.java | 2 +- .../java/org/finos/legend/engine/repl/TestParserFixer.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/autocomplete/parser/ParserFixer.java b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/autocomplete/parser/ParserFixer.java index 0fefa67bcef..45edea5187e 100644 --- a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/autocomplete/parser/ParserFixer.java +++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/autocomplete/parser/ParserFixer.java @@ -207,7 +207,7 @@ else if (buffer) } if (content.contains("{") && !content.contains("}")) { - return value + magicToken + "}#"; + return (value.contains(magicToken) ? value : value + magicToken) + "}#"; } if (content.contains("{") && content.contains("}")) { diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/test/java/org/finos/legend/engine/repl/TestParserFixer.java b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/test/java/org/finos/legend/engine/repl/TestParserFixer.java index 35066224fa1..1d391b727f7 100644 --- a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/test/java/org/finos/legend/engine/repl/TestParserFixer.java +++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/test/java/org/finos/legend/engine/repl/TestParserFixer.java @@ -37,11 +37,11 @@ public void testArithmetic() public void testIsland() { Assert.assertEquals("#MaGiCToKeN{}#", fixCode("#")); - Assert.assertEquals("#>{}#", fixCode("#>")); - Assert.assertEquals("#>{}#", fixCode("#>{")); + Assert.assertEquals("#>{MaGiCToKeN}#", fixCode("#>")); + Assert.assertEquals("#>{MaGiCToKeN}#", fixCode("#>{")); Assert.assertEquals("#>{}#", fixCode("#>{}")); Assert.assertEquals("#>{a::A.t}#->fil()", fixCode("#>{a::A.t}#->fil")); - Assert.assertEquals("#>{a::A.t}#->x(#>{}#)", fixCode("#>{a::A.t}#->x(#>")); + Assert.assertEquals("#>{a::A.t}#->x(#>{MaGiCToKeN}#)", fixCode("#>{a::A.t}#->x(#>")); Assert.assertEquals("#>{a::A.t}#->x(#>{a::A.MaGiCToKeN}#)", fixCode("#>{a::A.t}#->x(#>{a::A.")); }