File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
test-source-links/dotty/tools/scaladoc/source-links Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -140,4 +140,3 @@ object SourceLinks:
140140 )
141141 SourceLinks (sourceLinks)
142142 }
143-
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ trait NameNormalizer { self: TastyParser =>
1717 private val ignoredKeywords : Set [String ] = Set (" this" )
1818
1919 private def escapedName (name : String ) =
20- val simpleIdentifierRegex = " ([([{}]) ]|[^A-Za-z0-9$]_)" .r
20+ val complexIdentifierRegex = """ ([([{}]) ]|[^A-Za-z0-9$]_)"" " .r
2121 name match
2222 case n if ignoredKeywords(n) => n
23- case n if keywords(termName(n)) || simpleIdentifierRegex .findFirstIn(n).isDefined => s " ` $n` "
23+ case n if keywords(termName(n)) || complexIdentifierRegex .findFirstIn(n).isDefined => s " ` $n` "
2424 case _ => name
2525}
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import org.junit.Test
1616
1717class RemoteLinksTest :
1818
19+ class TimeoutException extends Exception
20+
1921 Random .setSeed(123L )
2022 val mtslAll = membersToSourceLinks(using testDocContext())
2123
@@ -44,20 +46,23 @@ class RemoteLinksTest:
4446 catch
4547 case e : java.lang.IllegalArgumentException =>
4648 report.error(s " Could not open link for $link - invalid URL " )(using testContext)
49+ case e : TimeoutException =>
50+ report.error(s " Tried to open link $link 16 times but with no avail " )(using testContext)
4751 case e : org.jsoup.HttpStatusException => e.getStatusCode match
4852 case 404 => throw AssertionError (s " Page $link does not exists " )
4953 case n => report.warning(s " Could not open link for $link, return code $n" )(using testContext)
5054 }
5155 assertNoErrors(testContext.reportedDiagnostics)
5256
53- private def getDocumentFromUrl (link : String ): Document =
57+ private def getDocumentFromUrl (link : String , retries : Int = 16 ): Document =
5458 try
59+ if retries == 0 then throw TimeoutException ()
5560 Jsoup .connect(link).get
5661 catch
5762 case e : org.jsoup.HttpStatusException => e.getStatusCode match
5863 case 429 =>
5964 Thread .sleep(10 )
60- getDocumentFromUrl(link)
65+ getDocumentFromUrl(link, retries - 1 )
6166 case n =>
6267 throw e
6368
You can’t perform that action at this time.
0 commit comments