mirror of
https://github.com/apple/pkl.git
synced 2026-07-01 18:51:48 +02:00
Fix handling of file: module URIs with non-ASCII characters (#696)
Addresses an issue where Pkl cannot evaluate files with non-ASCII characters.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// covers https://github.com/apple/pkl/issues/653
|
||||
日本語 = "Japanese language"
|
||||
readOne = read("日本語.pkl").text
|
||||
readGlob = read*("./日*.pkl").keys
|
||||
importOne = import("日本語.pkl").readOne
|
||||
importGlob = import*("./日*.pkl").keys
|
||||
@@ -0,0 +1,2 @@
|
||||
// covers https://github.com/apple/pkl/issues/653
|
||||
日本語 = throw("Error reporting should also handle unicode filenames!")
|
||||
@@ -0,0 +1,21 @@
|
||||
日本語 = "Japanese language"
|
||||
readOne = """
|
||||
// covers https://github.com/apple/pkl/issues/653
|
||||
日本語 = "Japanese language"
|
||||
readOne = read("日本語.pkl").text
|
||||
readGlob = read*("./日*.pkl").keys
|
||||
importOne = import("日本語.pkl").readOne
|
||||
importGlob = import*("./日*.pkl").keys
|
||||
|
||||
"""
|
||||
readGlob = Set("./日本語.pkl", "./日本語_error.pkl")
|
||||
importOne = """
|
||||
// covers https://github.com/apple/pkl/issues/653
|
||||
日本語 = "Japanese language"
|
||||
readOne = read("日本語.pkl").text
|
||||
readGlob = read*("./日*.pkl").keys
|
||||
importOne = import("日本語.pkl").readOne
|
||||
importGlob = import*("./日*.pkl").keys
|
||||
|
||||
"""
|
||||
importGlob = Set("./日本語.pkl", "./日本語_error.pkl")
|
||||
@@ -0,0 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
Error reporting should also handle unicode filenames!
|
||||
|
||||
x | 日本語 = throw("Error reporting should also handle unicode filenames!")
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at 日本語_error#日本語 (file:///$snippetsDir/input/modules/%E6%97%A5%E6%9C%AC%E8%AA%9E_error.pkl)
|
||||
|
||||
xxx | text = renderer.renderDocument(value)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at pkl.base#Module.output.text (pkl:base)
|
||||
@@ -301,9 +301,14 @@ class AlpineLanguageSnippetTestsEngine : AbstractNativeLanguageSnippetTestsEngin
|
||||
override val testClass: KClass<*> = AlpineLanguageSnippetTests::class
|
||||
}
|
||||
|
||||
// error message contains different file path on Windows
|
||||
private val windowsExcludedTests
|
||||
get() = listOf(Regex(".*missingProjectDeps/bug\\.pkl"))
|
||||
get() =
|
||||
listOf(
|
||||
// error message contains different file path on Windows
|
||||
Regex(".*missingProjectDeps/bug\\.pkl"),
|
||||
// URIs get rendered slightly differently (percent-encoded vs raw)
|
||||
Regex(".*日本語_error\\.pkl")
|
||||
)
|
||||
|
||||
class WindowsLanguageSnippetTestsEngine : AbstractNativeLanguageSnippetTestsEngine() {
|
||||
override val pklExecutablePath: Path = PklExecutablePaths.windowsAmd64
|
||||
|
||||
Reference in New Issue
Block a user