From eba7d3edbcc95ee209b0e81cef2db0e3683a2b47 Mon Sep 17 00:00:00 2001 From: Alexander Raszka Date: Sun, 4 Feb 2024 14:36:42 +0100 Subject: [PATCH] Disable double interpolation test because of bad algorithm --- src/ManiaTemplates/Lib/MtTransformer.cs | 37 ++++++++++--------- .../Lib/MtTransformerTest.cs | 16 ++++---- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/ManiaTemplates/Lib/MtTransformer.cs b/src/ManiaTemplates/Lib/MtTransformer.cs index 244d0c3..3230778 100644 --- a/src/ManiaTemplates/Lib/MtTransformer.cs +++ b/src/ManiaTemplates/Lib/MtTransformer.cs @@ -1182,24 +1182,25 @@ public static string ReplaceCurlyBraces(string value, Func curly /// public static void CheckInterpolationRecursion(string value) { - var openCurlyBraces = 0; - foreach (var character in value.ToCharArray()) - { - if (character == '{') - { - openCurlyBraces++; - - if (openCurlyBraces >= 4) - { - throw new InterpolationRecursionException( - $"Double interpolation found in: {value}. You must not use double curly braces inside other double curly braces."); - } - } - else if (character == '}') - { - openCurlyBraces--; - } - } + //TODO: find proper algorithm + // var openCurlyBraces = 0; + // foreach (var character in value.ToCharArray()) + // { + // if (character == '{') + // { + // openCurlyBraces++; + // + // if (openCurlyBraces >= 4) + // { + // throw new InterpolationRecursionException( + // $"Double interpolation found in: {value}. You must not use double curly braces inside other double curly braces."); + // } + // } + // else if (character == '}') + // { + // openCurlyBraces--; + // } + // } } /// diff --git a/tests/ManiaTemplates.Tests/Lib/MtTransformerTest.cs b/tests/ManiaTemplates.Tests/Lib/MtTransformerTest.cs index ea61d45..10b99f6 100644 --- a/tests/ManiaTemplates.Tests/Lib/MtTransformerTest.cs +++ b/tests/ManiaTemplates.Tests/Lib/MtTransformerTest.cs @@ -133,14 +133,14 @@ public void Should_Import_Components_Recursively() ", output, ignoreLineEndingDifferences: true); } - [Fact] - public void Should_Throw_Interpolation_Recursion_Exception() - { - Assert.Throws(() => - MtTransformer.CheckInterpolationRecursion("{{ {{ a }} {{ b }} }}")); - Assert.Throws(() => - MtTransformer.CheckInterpolationRecursion("{{ {{ b }} }}")); - } + // [Fact] + // public void Should_Throw_Interpolation_Recursion_Exception() + // { + // Assert.Throws(() => + // MtTransformer.CheckInterpolationRecursion("{{ {{ a }} {{ b }} }}")); + // Assert.Throws(() => + // MtTransformer.CheckInterpolationRecursion("{{ {{ b }} }}")); + // } [Fact] public void Should_Throw_Curly_Brace_Count_Mismatch_Exception()