Skip to content

Commit

Permalink
Make RemoveLinksTests better
Browse files Browse the repository at this point in the history
Sort files and properly handle end line
  • Loading branch information
romanowski committed Jul 29, 2021
1 parent a28aee1 commit 16d4450
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ 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")
members.foreach { case (member, expectedLine) =>
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)
Expand Down

0 comments on commit 16d4450

Please sign in to comment.