From 1b4635d27edc3cb944cdd478b0d69d2441253a2b Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 26 Apr 2026 00:22:41 +0200 Subject: [PATCH] missing file --- compiler/test/helpers/Strings.kt | 18 ++++++++++++++++++ scripts/clean.sh | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 compiler/test/helpers/Strings.kt diff --git a/compiler/test/helpers/Strings.kt b/compiler/test/helpers/Strings.kt new file mode 100644 index 000000000..c96fe074c --- /dev/null +++ b/compiler/test/helpers/Strings.kt @@ -0,0 +1,18 @@ +package prog8tests.helpers + +import io.kotest.assertions.fail + +/** + * Asserts that the string contains the given [substrings] in the specified order. + * This is much faster than using a large multi-line Regex. + */ +fun String.shouldContainInOrder(vararg substrings: String) { + var currentSearchIndex = 0 + for (substring in substrings) { + val index = this.indexOf(substring, currentSearchIndex) + if (index == -1) { + fail("Could not find '$substring' after index $currentSearchIndex in string:\n$this") + } + currentSearchIndex = index + substring.length + } +} diff --git a/scripts/clean.sh b/scripts/clean.sh index ad37a1ad9..240ac4ab0 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -2,5 +2,5 @@ rm -f *.bin *.xex *.jar *.asm *.prg *.vm.txt *.vice-mon-list *.list *.p8ir a.out imgui.ini rm -rf build out -rm -rf compiler/build codeGenCpu6502/build codeGenExperimental/build codeGenIntermediate/build intermediate/build virtualmachine/build codeOptimizers/build compilerAst/build parser/build parser/src/prog8/parser +rm -rf compiler/build codeGenCpu6502/build codeGenExperimental/build codeGenIntermediate/build intermediate/build virtualmachine/build codeOptimizers/build compilerAst/build languageServer/build parser/build parser/src/prog8/parser