mirror of
https://github.com/apple/pkl.git
synced 2026-03-25 02:21:11 +01:00
Run spotless formatting (#958)
When we updated spotless's Java and Kotlin formatter, we changed the underlying formatting rules. However, due to spotless ratcheting, these formatting changes don't get applied unless a file gets touched in a commit. To avoid future PRs introducing lines of change that aren't related to the intention of the PR, this is a one-time format of all files.
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.
|
||||
@@ -80,7 +80,7 @@ class MemberRegistryGenerator : AbstractProcessor() {
|
||||
if (it.enclosingElement.kind == ElementKind.PACKAGE) ""
|
||||
else it.enclosingElement.simpleName.toString()
|
||||
},
|
||||
{ it.simpleName.toString() }
|
||||
{ it.simpleName.toString() },
|
||||
)
|
||||
)
|
||||
.groupBy { processingEnv.elementUtils.getPackageOf(it) }
|
||||
@@ -126,7 +126,7 @@ class MemberRegistryGenerator : AbstractProcessor() {
|
||||
registryClassConstructor.addStatement(
|
||||
"register(\$S, \$T::create)",
|
||||
pklMemberNameQualified,
|
||||
nodeClass
|
||||
nodeClass,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -118,14 +118,14 @@ public final class CodeGeneratorUtils {
|
||||
*/
|
||||
private static boolean isValidIdentifierPart(int codePoint, int category) {
|
||||
return switch (category) {
|
||||
// NOT Character.CURRENCY_SYMBOL, which is valid in Java, but invalid in Kotlin
|
||||
// NOT Character.CURRENCY_SYMBOL, which is valid in Java, but invalid in Kotlin
|
||||
case Character.LOWERCASE_LETTER,
|
||||
Character.UPPERCASE_LETTER,
|
||||
Character.MODIFIER_LETTER,
|
||||
Character.OTHER_LETTER,
|
||||
Character.TITLECASE_LETTER,
|
||||
Character.LETTER_NUMBER,
|
||||
Character.DECIMAL_DIGIT_NUMBER ->
|
||||
Character.UPPERCASE_LETTER,
|
||||
Character.MODIFIER_LETTER,
|
||||
Character.OTHER_LETTER,
|
||||
Character.TITLECASE_LETTER,
|
||||
Character.LETTER_NUMBER,
|
||||
Character.DECIMAL_DIGIT_NUMBER ->
|
||||
true;
|
||||
default -> codePoint == UNDERSCORE;
|
||||
};
|
||||
@@ -133,18 +133,18 @@ public final class CodeGeneratorUtils {
|
||||
|
||||
private static boolean isPunctuationOrSpacing(int category) {
|
||||
return switch (category) {
|
||||
// Punctuation
|
||||
// Punctuation
|
||||
case Character.CONNECTOR_PUNCTUATION, // Pc
|
||||
Character.DASH_PUNCTUATION, // Pd
|
||||
Character.START_PUNCTUATION, // Ps
|
||||
Character.END_PUNCTUATION, // Pe
|
||||
Character.INITIAL_QUOTE_PUNCTUATION, // Pi
|
||||
Character.FINAL_QUOTE_PUNCTUATION, // Pf
|
||||
Character.OTHER_PUNCTUATION, // Po
|
||||
// Spacing
|
||||
Character.SPACE_SEPARATOR, // Zs
|
||||
Character.LINE_SEPARATOR, // Zl
|
||||
Character.PARAGRAPH_SEPARATOR -> // Zp
|
||||
Character.DASH_PUNCTUATION, // Pd
|
||||
Character.START_PUNCTUATION, // Ps
|
||||
Character.END_PUNCTUATION, // Pe
|
||||
Character.INITIAL_QUOTE_PUNCTUATION, // Pi
|
||||
Character.FINAL_QUOTE_PUNCTUATION, // Pf
|
||||
Character.OTHER_PUNCTUATION, // Po
|
||||
// Spacing
|
||||
Character.SPACE_SEPARATOR, // Zs
|
||||
Character.LINE_SEPARATOR, // Zl
|
||||
Character.PARAGRAPH_SEPARATOR -> // Zp
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -227,7 +227,7 @@ public final class GlobResolver {
|
||||
sb.append("!");
|
||||
}
|
||||
|
||||
// no special meaning in glob patterns but have special meaning in regex.
|
||||
// no special meaning in glob patterns but have special meaning in regex.
|
||||
case '.', '(', '%', '^', '$', '|' -> sb.append("\\").append(current);
|
||||
default -> sb.append(current);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -611,27 +611,27 @@ public final class IoUtils {
|
||||
public static boolean isHexDigit(char ch) {
|
||||
return switch (ch) {
|
||||
case '0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f' ->
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f' ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
@@ -640,28 +640,28 @@ public final class IoUtils {
|
||||
public static boolean isHexDigitOrUnderscore(char ch) {
|
||||
return switch (ch) {
|
||||
case '0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'_' ->
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'_' ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
@@ -751,46 +751,46 @@ public final class IoUtils {
|
||||
public static boolean isReservedWindowsFilenameChar(char character) {
|
||||
return switch (character) {
|
||||
case 0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
31,
|
||||
'<',
|
||||
'>',
|
||||
':',
|
||||
'"',
|
||||
'\\',
|
||||
'/',
|
||||
'|',
|
||||
'?',
|
||||
'*' ->
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
31,
|
||||
'<',
|
||||
'>',
|
||||
':',
|
||||
'"',
|
||||
'\\',
|
||||
'/',
|
||||
'|',
|
||||
'?',
|
||||
'*' ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -563,7 +563,7 @@ public final class JsonWriter implements Closeable, Flushable {
|
||||
if (!lenient) {
|
||||
throw new IllegalStateException("JSON must have only one top-level value.");
|
||||
}
|
||||
// fall-through
|
||||
// fall-through
|
||||
case EMPTY_DOCUMENT: // first in document
|
||||
replaceTop(NONEMPTY_DOCUMENT);
|
||||
break;
|
||||
|
||||
@@ -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.
|
||||
@@ -29,28 +29,28 @@ public final class Yaml12Emitter extends YamlEmitter {
|
||||
|
||||
return switch (str) {
|
||||
case "",
|
||||
"~",
|
||||
"null",
|
||||
"Null",
|
||||
"NULL",
|
||||
".nan",
|
||||
".NaN",
|
||||
".NAN",
|
||||
".inf",
|
||||
".Inf",
|
||||
".INF",
|
||||
"+.inf",
|
||||
"+.Inf",
|
||||
"+.INF",
|
||||
"-.inf",
|
||||
"-.Inf",
|
||||
"-.INF",
|
||||
"true",
|
||||
"True",
|
||||
"TRUE",
|
||||
"false",
|
||||
"False",
|
||||
"FALSE" ->
|
||||
"~",
|
||||
"null",
|
||||
"Null",
|
||||
"NULL",
|
||||
".nan",
|
||||
".NaN",
|
||||
".NAN",
|
||||
".inf",
|
||||
".Inf",
|
||||
".INF",
|
||||
"+.inf",
|
||||
"+.Inf",
|
||||
"+.INF",
|
||||
"-.inf",
|
||||
"-.Inf",
|
||||
"-.INF",
|
||||
"true",
|
||||
"True",
|
||||
"TRUE",
|
||||
"false",
|
||||
"False",
|
||||
"FALSE" ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -137,7 +137,7 @@ public abstract class YamlEmitter {
|
||||
needsQuoting =
|
||||
needsQuoting || i == (length - 1) || (i + 1 < length) && str.charAt(i + 1) == ' ';
|
||||
}
|
||||
// number chars
|
||||
// number chars
|
||||
case '0',
|
||||
'1',
|
||||
'2',
|
||||
@@ -228,44 +228,44 @@ public abstract class YamlEmitter {
|
||||
|
||||
return switch (str) {
|
||||
case "",
|
||||
"~",
|
||||
"null",
|
||||
"Null",
|
||||
"NULL",
|
||||
".nan",
|
||||
".NaN",
|
||||
".NAN",
|
||||
".inf",
|
||||
".Inf",
|
||||
".INF",
|
||||
"+.inf",
|
||||
"+.Inf",
|
||||
"+.INF",
|
||||
"-.inf",
|
||||
"-.Inf",
|
||||
"-.INF",
|
||||
"true",
|
||||
"True",
|
||||
"TRUE",
|
||||
"false",
|
||||
"False",
|
||||
"FALSE",
|
||||
"on",
|
||||
"On",
|
||||
"ON",
|
||||
"off",
|
||||
"Off",
|
||||
"OFF",
|
||||
"y",
|
||||
"Y",
|
||||
"yes",
|
||||
"Yes",
|
||||
"YES",
|
||||
"n",
|
||||
"N",
|
||||
"no",
|
||||
"No",
|
||||
"NO" ->
|
||||
"~",
|
||||
"null",
|
||||
"Null",
|
||||
"NULL",
|
||||
".nan",
|
||||
".NaN",
|
||||
".NAN",
|
||||
".inf",
|
||||
".Inf",
|
||||
".INF",
|
||||
"+.inf",
|
||||
"+.Inf",
|
||||
"+.INF",
|
||||
"-.inf",
|
||||
"-.Inf",
|
||||
"-.INF",
|
||||
"true",
|
||||
"True",
|
||||
"TRUE",
|
||||
"false",
|
||||
"False",
|
||||
"FALSE",
|
||||
"on",
|
||||
"On",
|
||||
"ON",
|
||||
"off",
|
||||
"Off",
|
||||
"OFF",
|
||||
"y",
|
||||
"Y",
|
||||
"yes",
|
||||
"Yes",
|
||||
"YES",
|
||||
"n",
|
||||
"N",
|
||||
"no",
|
||||
"No",
|
||||
"NO" ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ class EvaluateTestsTest {
|
||||
"""
|
||||
.trimIndent()
|
||||
),
|
||||
true
|
||||
true,
|
||||
)
|
||||
|
||||
assertThat(results.moduleName).isEqualTo("text")
|
||||
@@ -75,7 +75,7 @@ class EvaluateTestsTest {
|
||||
"""
|
||||
.trimIndent()
|
||||
),
|
||||
true
|
||||
true,
|
||||
)
|
||||
|
||||
assertThat(results.totalTests()).isEqualTo(1)
|
||||
@@ -111,7 +111,7 @@ class EvaluateTestsTest {
|
||||
"""
|
||||
.trimIndent()
|
||||
),
|
||||
true
|
||||
true,
|
||||
)
|
||||
|
||||
assertThat(results.totalTests()).isEqualTo(1)
|
||||
@@ -157,7 +157,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
Files.writeString(
|
||||
@@ -172,7 +172,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
val results = evaluator.evaluateTest(path(file), false)
|
||||
@@ -207,7 +207,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
Files.writeString(
|
||||
@@ -222,7 +222,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
val results = evaluator.evaluateTest(path(file), false)
|
||||
@@ -260,7 +260,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
Files.writeString(
|
||||
@@ -275,7 +275,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
val results = evaluator.evaluateTest(path(file), false)
|
||||
@@ -314,7 +314,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
Files.writeString(
|
||||
@@ -329,7 +329,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
val results = evaluator.evaluateTest(path(file), false)
|
||||
@@ -377,7 +377,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
evaluator.evaluateTest(path(file), false)
|
||||
val expectedFile = file.parent.resolve(file.fileName.toString() + "-expected.pcf")
|
||||
@@ -411,7 +411,7 @@ class EvaluateTestsTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
createExpected(file)
|
||||
.writeString(
|
||||
|
||||
@@ -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.
|
||||
@@ -128,7 +128,7 @@ class PModuleTest {
|
||||
moduleUri,
|
||||
moduleName,
|
||||
classInfo,
|
||||
mapOf("name" to "Pigeon", "age" to 42, "other" to true)
|
||||
mapOf("name" to "Pigeon", "age" to 42, "other" to true),
|
||||
)
|
||||
|
||||
assertThat(pigeon2).isNotEqualTo(pigeon)
|
||||
|
||||
@@ -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.
|
||||
@@ -106,7 +106,7 @@ class PObjectTest {
|
||||
val pigeon2 =
|
||||
PObject(
|
||||
PClassInfo.get("test", "Person", URI("repl:test")),
|
||||
mapOf("name" to "Pigeon", "age" to 21)
|
||||
mapOf("name" to "Pigeon", "age" to 21),
|
||||
)
|
||||
|
||||
assertThat(pigeon2).isNotEqualTo(pigeon)
|
||||
@@ -127,7 +127,7 @@ class PObjectTest {
|
||||
val pigeon2 =
|
||||
PObject(
|
||||
PClassInfo.get("test", "Person", URI("repl:test")),
|
||||
mapOf("name" to "Pigeon", "age" to 42, "other" to true)
|
||||
mapOf("name" to "Pigeon", "age" to 42, "other" to true),
|
||||
)
|
||||
|
||||
assertThat(pigeon2).isNotEqualTo(pigeon)
|
||||
|
||||
@@ -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.
|
||||
@@ -73,7 +73,7 @@ class PcfRendererTest {
|
||||
grault = Map("garply", null, "waldo", 42, "pigeon", null)
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
.trimIndent(),
|
||||
)
|
||||
|
||||
val module =
|
||||
|
||||
@@ -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.
|
||||
@@ -48,7 +48,7 @@ class PropertiesRendererTest {
|
||||
"new Mapping {}",
|
||||
"Set()",
|
||||
"new PropertiesRenderer {}",
|
||||
"new Dynamic {}"
|
||||
"new Dynamic {}",
|
||||
)
|
||||
|
||||
unsupportedValues.forEach {
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ class ReplServerTest {
|
||||
listOf(
|
||||
ModuleKeyFactories.standardLibrary,
|
||||
ModuleKeyFactories.classPath(this::class.java.classLoader),
|
||||
ModuleKeyFactories.file
|
||||
ModuleKeyFactories.file,
|
||||
),
|
||||
listOf(ResourceReaders.environmentVariable(), ResourceReaders.externalProperty()),
|
||||
mapOf("NAME1" to "value1", "NAME2" to "value2"),
|
||||
@@ -72,7 +72,7 @@ class ReplServerTest {
|
||||
"length()",
|
||||
"getClass()",
|
||||
"toString()",
|
||||
"toTyped("
|
||||
"toTyped(",
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class ReplServerTest {
|
||||
"getPropertyOrNull(",
|
||||
"hasProperty(",
|
||||
"relativePathTo(",
|
||||
"toString()"
|
||||
"toString()",
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -32,7 +32,7 @@ class SecurityManagersTest {
|
||||
listOf(Pattern.compile("test:foo/bar")),
|
||||
listOf(Pattern.compile("env:FOO_BAR")),
|
||||
{ uri -> if (uri.scheme == "one") 1 else if (uri.scheme == "two") 2 else 0 },
|
||||
null
|
||||
null,
|
||||
)
|
||||
|
||||
@Test
|
||||
@@ -142,7 +142,7 @@ class SecurityManagersTest {
|
||||
listOf(Pattern.compile("file")),
|
||||
listOf(Pattern.compile("file")),
|
||||
SecurityManagers.defaultTrustLevels,
|
||||
rootDir
|
||||
rootDir,
|
||||
)
|
||||
|
||||
val path = rootDir.resolve("baz.pkl")
|
||||
@@ -163,7 +163,7 @@ class SecurityManagersTest {
|
||||
listOf(Pattern.compile("file")),
|
||||
listOf(Pattern.compile("file")),
|
||||
SecurityManagers.defaultTrustLevels,
|
||||
rootDir
|
||||
rootDir,
|
||||
)
|
||||
|
||||
manager.checkResolveModule(Path.of("/foo/bar/baz.pkl").toUri())
|
||||
@@ -185,7 +185,7 @@ class SecurityManagersTest {
|
||||
listOf(Pattern.compile("file")),
|
||||
listOf(Pattern.compile("file")),
|
||||
SecurityManagers.defaultTrustLevels,
|
||||
rootDir
|
||||
rootDir,
|
||||
)
|
||||
|
||||
val path = rootDir.resolve("../baz.pkl")
|
||||
@@ -210,7 +210,7 @@ class SecurityManagersTest {
|
||||
listOf(Pattern.compile("file")),
|
||||
listOf(Pattern.compile("file")),
|
||||
SecurityManagers.defaultTrustLevels,
|
||||
rootDir
|
||||
rootDir,
|
||||
)
|
||||
|
||||
assertThrows<SecurityManagerException> {
|
||||
|
||||
@@ -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.
|
||||
@@ -27,7 +27,7 @@ import org.pkl.core.util.Nullable
|
||||
class ExternalReaderRuntime(
|
||||
private val moduleReaders: List<ExternalModuleReader>,
|
||||
private val resourceReaders: List<ExternalResourceReader>,
|
||||
private val transport: MessageTransport
|
||||
private val transport: MessageTransport,
|
||||
) {
|
||||
/** Close the runtime and its transport. */
|
||||
fun close() {
|
||||
@@ -96,7 +96,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
null,
|
||||
"No module reader found for scheme " + req.uri.scheme
|
||||
"No module reader found for scheme " + req.uri.scheme,
|
||||
)
|
||||
)
|
||||
return@start
|
||||
@@ -107,7 +107,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
reader.listElements(req.uri),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
@@ -125,7 +125,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
null,
|
||||
"No resource reader found for scheme " + req.uri.scheme
|
||||
"No resource reader found for scheme " + req.uri.scheme,
|
||||
)
|
||||
)
|
||||
return@start
|
||||
@@ -136,7 +136,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
reader.listElements(req.uri),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
@@ -154,7 +154,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
null,
|
||||
"No module reader found for scheme " + req.uri.scheme
|
||||
"No module reader found for scheme " + req.uri.scheme,
|
||||
)
|
||||
)
|
||||
return@start
|
||||
@@ -176,7 +176,7 @@ class ExternalReaderRuntime(
|
||||
req.requestId,
|
||||
req.evaluatorId,
|
||||
byteArrayOf(),
|
||||
"No resource reader found for scheme " + req.uri.scheme
|
||||
"No resource reader found for scheme " + req.uri.scheme,
|
||||
)
|
||||
)
|
||||
return@start
|
||||
@@ -193,7 +193,7 @@ class ExternalReaderRuntime(
|
||||
}
|
||||
else -> throw ProtocolException("Unexpected incoming request message: $msg")
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -24,7 +24,7 @@ class RequestCapturingClient : HttpClient {
|
||||
|
||||
override fun <T : Any> send(
|
||||
request: HttpRequest,
|
||||
responseBodyHandler: HttpResponse.BodyHandler<T>
|
||||
responseBodyHandler: HttpResponse.BodyHandler<T>,
|
||||
): HttpResponse<T> {
|
||||
this.request = request
|
||||
return FakeHttpResponse()
|
||||
|
||||
@@ -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.
|
||||
@@ -74,7 +74,7 @@ class BaseMessagePackCodecTest {
|
||||
123,
|
||||
234,
|
||||
listOf(PathElement("foo", true), PathElement("bar", false)),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
roundtrip(ListModulesResponse(123, 234, null, "Something dun went wrong"))
|
||||
@@ -92,7 +92,7 @@ class BaseMessagePackCodecTest {
|
||||
3851,
|
||||
3019,
|
||||
listOf(PathElement("foo", true), PathElement("bar", false)),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
roundtrip(ListResourcesResponse(3851, 3019, null, "something went wrong"))
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ class ServiceProviderTest {
|
||||
uri,
|
||||
"testFactoryTest",
|
||||
PClassInfo.forModuleClass("testFactoryTest", uri),
|
||||
mapOf("name" to "Pigeon", "age" to 40L)
|
||||
mapOf("name" to "Pigeon", "age" to 40L),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -35,8 +35,8 @@ class DependencyMetadataTest {
|
||||
"foo" to
|
||||
Dependency.RemoteDependency(
|
||||
PackageUri("package://example.com/foo@0.5.3"),
|
||||
Checksums("abc123")
|
||||
),
|
||||
Checksums("abc123"),
|
||||
)
|
||||
),
|
||||
"https://example.com/my/source/0.5.3/blob%{path}#L%{line}-L%{endLine}",
|
||||
URI("https://example.com/my/source"),
|
||||
@@ -62,9 +62,9 @@ class DependencyMetadataTest {
|
||||
"map" to mapOf(true to "t", false to "f"),
|
||||
"dataSize" to DataSize(1.5, DataSizeUnit.GIGABYTES),
|
||||
"duration" to Duration(2.9, DurationUnit.HOURS),
|
||||
"pair" to Pair(1L, "1")
|
||||
)
|
||||
)
|
||||
"pair" to Pair(1L, "1"),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
private val dependencyMetadataStr =
|
||||
@@ -204,7 +204,7 @@ class DependencyMetadataTest {
|
||||
listOf(
|
||||
PObject(
|
||||
PClassInfo.get("myModule", "MyAnnotation", URI("pkl:fake")),
|
||||
mapOf("pattern" to Regex(".*").toPattern())
|
||||
mapOf("pattern" to Regex(".*").toPattern()),
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
@@ -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.
|
||||
@@ -54,13 +54,13 @@ class ProjectDepsTest {
|
||||
CanonicalPackageUri.of("package://localhost:0/birds@0"),
|
||||
Dependency.RemoteDependency(
|
||||
PackageUri.create("package://localhost:0/birds@0.5.0"),
|
||||
Checksums("abc123")
|
||||
Checksums("abc123"),
|
||||
),
|
||||
CanonicalPackageUri.of("package://localhost:0/fruit@1"),
|
||||
Dependency.LocalDependency(
|
||||
PackageUri.create("package://localhost:0/fruit@1.1.0"),
|
||||
Path.of("../fruit")
|
||||
)
|
||||
Path.of("../fruit"),
|
||||
),
|
||||
)
|
||||
ProjectDeps(projectDepsMap)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -57,7 +57,7 @@ class ProjectTest {
|
||||
.trimIndent(),
|
||||
URI("https://example.com/my/issues"),
|
||||
listOf(Path.of("apiTest1.pkl"), Path.of("apiTest2.pkl")),
|
||||
listOf("PklProject", "PklProject.deps.json", ".**", "*.exe")
|
||||
listOf("PklProject", "PklProject.deps.json", ".**", "*.exe"),
|
||||
)
|
||||
val expectedSettings =
|
||||
PklEvaluatorSettings(
|
||||
@@ -73,13 +73,13 @@ class ProjectTest {
|
||||
path,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
)
|
||||
val expectedAnnotations =
|
||||
listOf(
|
||||
PObject(
|
||||
PClassInfo.Deprecated,
|
||||
mapOf("since" to "1.2", "message" to "do not use", "replaceWith" to "somethingElse")
|
||||
mapOf("since" to "1.2", "message" to "do not use", "replaceWith" to "somethingElse"),
|
||||
),
|
||||
PObject(PClassInfo.Unlisted, mapOf()),
|
||||
PObject(PClassInfo.ModuleInfo, mapOf("minPklVersion" to "0.26.0")),
|
||||
|
||||
@@ -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.
|
||||
@@ -45,7 +45,7 @@ class PathSpecParserTest {
|
||||
Identifier.get("prop3"),
|
||||
Identifier.get("prop2"),
|
||||
Identifier.get("prop1"),
|
||||
TOP_LEVEL_VALUE
|
||||
TOP_LEVEL_VALUE,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -98,7 +98,7 @@ class PathSpecParserTest {
|
||||
"key2",
|
||||
WILDCARD_PROPERTY,
|
||||
"key1",
|
||||
Identifier.get("prop1")
|
||||
Identifier.get("prop1"),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -111,7 +111,7 @@ class PathSpecParserTest {
|
||||
WILDCARD_PROPERTY,
|
||||
"key1",
|
||||
Identifier.get("prop1"),
|
||||
TOP_LEVEL_VALUE
|
||||
TOP_LEVEL_VALUE,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ class ReflectModuleTest {
|
||||
"pkl:shell",
|
||||
"pkl:test",
|
||||
"pkl:xml",
|
||||
"pkl:yaml"
|
||||
"pkl:yaml",
|
||||
]
|
||||
)
|
||||
@ParameterizedTest(name = "can reflect on {0} module")
|
||||
|
||||
@@ -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.
|
||||
@@ -35,9 +35,11 @@ class LongVsDoubleSpecializationTest {
|
||||
fun addition() {
|
||||
val result =
|
||||
evaluator.evaluate(
|
||||
ModuleSource.text("""
|
||||
ModuleSource.text(
|
||||
"""
|
||||
x1 = Pair(1.0 + 2.0, 1 + 2).second
|
||||
""")
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assertThat(result.properties["x1"]).isEqualTo(3L)
|
||||
@@ -47,9 +49,11 @@ class LongVsDoubleSpecializationTest {
|
||||
fun subtraction() {
|
||||
val result =
|
||||
evaluator.evaluate(
|
||||
ModuleSource.text("""
|
||||
ModuleSource.text(
|
||||
"""
|
||||
x1 = Pair(1.0 - 2.0, 1 - 2).second
|
||||
""")
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assertThat(result.properties["x1"]).isEqualTo(-1L)
|
||||
@@ -59,9 +63,11 @@ class LongVsDoubleSpecializationTest {
|
||||
fun multiplication() {
|
||||
val result =
|
||||
evaluator.evaluate(
|
||||
ModuleSource.text("""
|
||||
ModuleSource.text(
|
||||
"""
|
||||
x1 = Pair(1.0 * 2.0, 1 * 2).second
|
||||
""")
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assertThat(result.properties["x1"]).isEqualTo(2L)
|
||||
|
||||
@@ -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.
|
||||
@@ -49,7 +49,7 @@ class GlobResolverTest {
|
||||
"baz.pkl",
|
||||
"buzzy...baz.pkl",
|
||||
"ted_lasso.min.pkl",
|
||||
"ted_lasso.pkl.min.pkl"
|
||||
"ted_lasso.pkl.min.pkl",
|
||||
]
|
||||
)
|
||||
fun `glob match`(input: String) {
|
||||
@@ -68,7 +68,7 @@ class GlobResolverTest {
|
||||
"pkl",
|
||||
// crosses directory boundaries
|
||||
"/bar/baz.pkl",
|
||||
"/baz.pkl"
|
||||
"/baz.pkl",
|
||||
]
|
||||
)
|
||||
fun `glob non-match`(input: String) {
|
||||
@@ -95,13 +95,7 @@ class GlobResolverTest {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(
|
||||
strings =
|
||||
[
|
||||
"/foo.pkl/bar/baz.pkl",
|
||||
"//fo///ba.pkl",
|
||||
]
|
||||
)
|
||||
@ValueSource(strings = ["/foo.pkl/bar/baz.pkl", "//fo///ba.pkl"])
|
||||
fun `globstar match 2`(input: String) {
|
||||
val pattern = GlobResolver.toRegexPattern("/**/*.pkl")
|
||||
assertTrue(pattern.matcher(input).matches())
|
||||
|
||||
@@ -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.
|
||||
@@ -29,10 +29,10 @@ class ImportGraphUtilsTest {
|
||||
ImportGraph(
|
||||
mapOf(
|
||||
fooUri to setOf(ImportGraph.Import(barUri)),
|
||||
barUri to setOf(ImportGraph.Import(fooUri))
|
||||
barUri to setOf(ImportGraph.Import(fooUri)),
|
||||
),
|
||||
// resolved URIs is not important
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
val cycles = ImportGraphUtils.findImportCycles(graph)
|
||||
assertThat(cycles).isEqualTo(listOf(listOf(fooUri, barUri)))
|
||||
@@ -50,10 +50,10 @@ class ImportGraphUtilsTest {
|
||||
fooUri to setOf(ImportGraph.Import(barUri)),
|
||||
barUri to setOf(ImportGraph.Import(fooUri)),
|
||||
bizUri to setOf(ImportGraph.Import(quxUri)),
|
||||
quxUri to setOf(ImportGraph.Import(bizUri))
|
||||
quxUri to setOf(ImportGraph.Import(bizUri)),
|
||||
),
|
||||
// resolved URIs is not important
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
val cycles = ImportGraphUtils.findImportCycles(graph)
|
||||
assertThat(cycles).isEqualTo(listOf(listOf(fooUri, barUri), listOf(bizUri, quxUri)))
|
||||
@@ -71,10 +71,10 @@ class ImportGraphUtilsTest {
|
||||
barUri to setOf(ImportGraph.Import(fooUri)),
|
||||
fooUri to setOf(ImportGraph.Import(bizUri)),
|
||||
bizUri to setOf(ImportGraph.Import(quxUri)),
|
||||
quxUri to setOf()
|
||||
quxUri to setOf(),
|
||||
),
|
||||
// resolved URIs is not important
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
val cycles = ImportGraphUtils.findImportCycles(graph)
|
||||
assertThat(cycles).isEmpty()
|
||||
@@ -87,7 +87,7 @@ class ImportGraphUtilsTest {
|
||||
ImportGraph(
|
||||
mapOf(fooUri to setOf(ImportGraph.Import(fooUri))),
|
||||
// resolved URIs is not important
|
||||
mapOf()
|
||||
mapOf(),
|
||||
)
|
||||
val cycles = ImportGraphUtils.findImportCycles(graph)
|
||||
assertThat(cycles).isEqualTo(listOf(listOf(fooUri)))
|
||||
|
||||
Reference in New Issue
Block a user