From 16d445088baac7413c1982b95ae4689b76ce7b8a Mon Sep 17 00:00:00 2001 From: Krzysztof Romanowski Date: Thu, 29 Jul 2021 11:49:03 +0200 Subject: [PATCH] Make RemoveLinksTests better Sort files and properly handle end line --- .../tools/scaladoc/source-links/RemoteLinksTest.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scaladoc/test-source-links/dotty/tools/scaladoc/source-links/RemoteLinksTest.scala b/scaladoc/test-source-links/dotty/tools/scaladoc/source-links/RemoteLinksTest.scala index 1a9831ec8bad..21a5d280c2e2 100644 --- a/scaladoc/test-source-links/dotty/tools/scaladoc/source-links/RemoteLinksTest.scala +++ b/scaladoc/test-source-links/dotty/tools/scaladoc/source-links/RemoteLinksTest.scala @@ -38,8 +38,9 @@ class RemoteLinksTest: def runTest = assertTrue(mtslAll.nonEmpty) val mtsl = randomGenerator.shuffle(mtslAll).take(80) // take 80 random entries - val pageToMtsl: Map[String, List[(String, String)]] = mtsl.groupMap(_._2.split("#L").head)(v => (v._1, v._2.split("#L").last)) - pageToMtsl.foreach { case (link, members) => + val pageToMtsl: Map[String, List[(String, String)]] = + mtsl.groupMap(_._2.split("#L").head)(v => (v._1, v._2.split("#L").last.toInt)) + pageToMtsl.toSeq.sortBy(_._1).foreach { case (link, members) => try val doc = getDocumentFromUrl(link) println(s"Checking $link") @@ -47,7 +48,7 @@ class RemoteLinksTest: if !member.startsWith("given_") then // TODO: handle synthetic givens, for now we disable them from testing val toLine = expectedLine + 3 val memberToMatch = member.replace("`", "") - val lineCorrectlyDefined = (expectedLine.toInt until toLine.toInt).exists{ line => + val lineCorrectlyDefined = (expectedLine.toInt until toLine).exists{ line => val loc = doc.select(s"#LC$line").text loc.contains(memberToMatch)