From cb4f899b8ce58b672e79ced71d518ab78b9d5ed7 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Thu, 27 Feb 2025 19:50:46 +0000 Subject: [PATCH] test: provide stdin as space-delimited tokens --- src/test/wacc/examples.scala | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/test/wacc/examples.scala b/src/test/wacc/examples.scala index fc7d544..f0e1a48 100644 --- a/src/test/wacc/examples.scala +++ b/src/test/wacc/examples.scala @@ -41,23 +41,7 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll { val inputLine = contents .find(_.matches("^# ?[Ii]nput:.*$")) - .map(line => - ("" :: line.split(":").last.strip.split(" ").toList) - .sliding(2) - .flatMap { arr => - if ( - // First entry has no space in front - arr(0) == "" || - // int followed by non-digit, space can be removed - arr(0).toIntOption.nonEmpty && !arr(1)(0).isDigit || - // non-int followed by int, space can be removed - !arr(0).last.isDigit && arr(1).toIntOption.nonEmpty - ) - then List(arr(1)) - else List(" ", arr(1)) - } - .mkString - ) + .map(_.split(":").last.strip + "\n") .getOrElse("") val outputLineIdx = contents.indexWhere(_.matches("^# ?[Oo]utput:.*$")) val expectedOutput = @@ -95,7 +79,7 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll { assert( stdout.toString .replaceAll("0x[0-9a-f]+", "#addrs#") - .replaceAll("fatal error:.*", "#runtime_error#\u0000") + .replaceAll("fatal error:.*", "#runtime_error#\n\u0000") .takeWhile(_ != '\u0000') == expectedOutput )