From 24a25292b8f12ef2788167a628499c959a3906e5 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Fri, 25 Apr 2025 16:13:01 +0200 Subject: [PATCH] fixes transcript writing --- Framework/Utils/Str.cs | 5 ++++- Tests/ExperimentalTests/CodexDistTest.cs | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Framework/Utils/Str.cs b/Framework/Utils/Str.cs index aea19ec8..ab8fe46d 100644 --- a/Framework/Utils/Str.cs +++ b/Framework/Utils/Str.cs @@ -4,8 +4,11 @@ { public static string Between(string input, string open, string close) { - var openIndex = input.IndexOf(open) + open.Length; + var openI = input.IndexOf(open); + if (openI == -1) return input; + var openIndex = openI + open.Length; var closeIndex = input.LastIndexOf(close); + if (closeIndex == -1) return input; return input.Substring(openIndex, closeIndex - openIndex); } diff --git a/Tests/ExperimentalTests/CodexDistTest.cs b/Tests/ExperimentalTests/CodexDistTest.cs index 5ecae330..422b5bd7 100644 --- a/Tests/ExperimentalTests/CodexDistTest.cs +++ b/Tests/ExperimentalTests/CodexDistTest.cs @@ -37,7 +37,6 @@ namespace CodexTests public void SetupCodexDistTest() { writer = SetupTranscript(); - } [TearDown] @@ -203,7 +202,7 @@ namespace CodexTests Stopwatch.Measure(log, $"Transcript.FinalizeWriter", () => { - writer.IncludeFile(log.GetFullName()); + writer.IncludeFile(log.GetFullName() + ".log"); writer.FinalizeWriter(); }); }