Skip to content

Commit

Permalink
Fix commitish detection in LanguageSnippetTest to also cover release …
Browse files Browse the repository at this point in the history
…versions (#537)
  • Loading branch information
holzensp authored Jun 17, 2024
1 parent 6009394 commit d55866a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,16 @@ abstract class AbstractLanguageSnippetTestsEngine : InputOutputTestEngine() {
protected fun String.stripVersionCheckErrorMessage() =
replace("Pkl version is ${Release.current().version()}", "Pkl version is xxx")

protected fun String.stripStdlibLocationSha(): String =
replace("https://github.com/apple/pkl/blob/${Release.current().commitId()}/stdlib/", "https://github.com/apple/pkl/blob/\$commitId/stdlib/")
protected fun String.stripStdlibLocationSha(): String {
// Logic must be kept in-sync with `doc-package-info.pkl`.
val commitIsh =
if (Release.current().version().isNormal) Release.current().version()
else Release.current().commitId()
return replace(
"https://github.com/apple/pkl/blob/${commitIsh}/stdlib/",
"https://github.com/apple/pkl/blob/\$commitId/stdlib/"
)
}

protected fun String.withUnixLineEndings(): String {
return if (System.lineSeparator() == "\r\n") replace("\r\n", "\n")
Expand Down

0 comments on commit d55866a

Please sign in to comment.