mirror of
https://github.com/apple/pkl.git
synced 2026-05-03 05:34:26 +02:00
Add ResourceReaders#fromServiceProviders to preconfigured evaluator (#1094)
The preconfigured evaluator currently adds module key factories from service providers, but not resource readers. This means that users of pkl-spring, for example, cannot add custom resource readers. This is also inconsistent (in the preconfigured evaluator, `import` can use custom schemes, but not `read`).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import org.pkl.core.project.Project
|
||||
import org.pkl.core.resource.TestResourceReader
|
||||
|
||||
class EvaluatorBuilderTest {
|
||||
@Test
|
||||
@@ -35,6 +36,12 @@ class EvaluatorBuilderTest {
|
||||
assertThat(builder.externalProperties).isEqualTo(System.getProperties())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `preconfigured builder adds resource readers from service providers`() {
|
||||
val builder = EvaluatorBuilder.preconfigured()
|
||||
assertThat(builder.resourceReaders).hasAtLeastOneElementOfType(TestResourceReader::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `unconfigured builder does not set process env vars`() {
|
||||
val builder = EvaluatorBuilder.unconfigured()
|
||||
|
||||
Reference in New Issue
Block a user