@@ -19,7 +19,8 @@ class RemoteLinksTest:
19
19
class TimeoutException extends Exception
20
20
21
21
val randomGenerator = new Random (125L )
22
- val mtslAll = membersToSourceLinks(using testDocContext())
22
+ // Predef has often problems with positions
23
+ val mtslAll = membersToSourceLinks(using testDocContext()).filter(_._1 != " Predef" )
23
24
24
25
@ Test
25
26
def scala213XSourceLink =
@@ -36,16 +37,23 @@ class RemoteLinksTest:
36
37
@ Test
37
38
def runTest =
38
39
assertTrue(mtslAll.nonEmpty)
39
- val mtsl = randomGenerator.shuffle(mtslAll).take(20 ) // take 20 random entries
40
+ val mtsl = randomGenerator.shuffle(mtslAll).take(40 ) // take 40 random entries
40
41
val pageToMtsl : Map [String , List [(String , String )]] = mtsl.groupMap(_._2.split(" #L" ).head)(v => (v._1, v._2.split(" #L" ).last))
41
42
pageToMtsl.foreach { case (link, members) =>
42
43
try
43
44
val doc = getDocumentFromUrl(link)
44
- members.foreach { (member, line) =>
45
+ println(s " Checking $link" )
46
+ members.foreach { case (member, expectedLine) =>
45
47
if ! member.startsWith(" given_" ) then // TODO: handle synthetic givens, for now we disable them from testing
46
- val loc = doc.select( s " #LC $line " ).text
48
+ val toLine = expectedLine + 3
47
49
val memberToMatch = member.replace(" `" , " " )
48
- assertTrue(s " Expected to find $memberToMatch at $link at line $line" , loc.contains(memberToMatch))
50
+ val lineCorrectlyDefined = (expectedLine.toInt until toLine.toInt).exists{ line =>
51
+ val loc = doc.select(s " #LC $line" ).text
52
+
53
+ loc.contains(memberToMatch)
54
+ }
55
+
56
+ assertTrue(s " Expected to find $memberToMatch at $link at lines $expectedLine- $toLine" , lineCorrectlyDefined)
49
57
}
50
58
catch
51
59
case e : java.lang.IllegalArgumentException =>
0 commit comments