diff --git a/pkl-core/src/test/files/LanguageSnippetTests/input/api/Resource.pkl b/pkl-core/src/test/files/LanguageSnippetTests/input/api/Resource.pkl index 2338d15f..a147af0d 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/input/api/Resource.pkl +++ b/pkl-core/src/test/files/LanguageSnippetTests/input/api/Resource.pkl @@ -16,16 +16,40 @@ examples { ["sha1"] { empty.sha1 + empty.bytes.sha1 fox.sha1 + fox.bytes.sha1 } ["sha256"] { empty.sha256 + empty.bytes.sha256 fox.sha256 + fox.bytes.sha256 } ["sha256Int"] { empty.sha256Int + empty.bytes.sha256Int fox.sha256Int + fox.bytes.sha256Int + } + + ["in-language"] { + new Resource { + base64 = Bytes(1, 2, 3, 4).base64 + }.sha256 + + new Resource { + uri = "foo:foo" + text = "foo bar" + base64 = text.base64 + } + + new Resource { bytes = Bytes(1, 2, 3, 4) }.sha256 + + new Resource { bytes = Bytes(1, 2, 3, 4) }.base64 + + new Resource { base64 = "AQIDBA==" }.bytes } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/api/Resource.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/api/Resource.pcf index 4bd8c29c..9aea990c 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/api/Resource.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/api/Resource.pcf @@ -9,14 +9,31 @@ examples { } ["sha1"] { "da39a3ee5e6b4b0d3255bfef95601890afd80709" + "da39a3ee5e6b4b0d3255bfef95601890afd80709" + "408d94384216f890ff7a0c3528e8bed1e0b01621" "408d94384216f890ff7a0c3528e8bed1e0b01621" } ["sha256"] { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c" "ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c" } ["sha256Int"] { 1449310910991872227 + 1449310910991872227 + -6359199461968751633 -6359199461968751633 } + ["in-language"] { + "9f64a747e1b97f131fabb6b447296c9b6f0201e79fb3c5356e6c77e89b6a806a" + new { + uri = "foo:foo" + text = "foo bar" + base64 = "Zm9vIGJhcg==" + } + "9f64a747e1b97f131fabb6b447296c9b6f0201e79fb3c5356e6c77e89b6a806a" + "AQIDBA==" + Bytes(1, 2, 3, 4) + } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf index cbb5a43a..da80db5f 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf @@ -13,9 +13,9 @@ alias { members = List(new { referent { location { - line = 1056 + line = 1058 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1056" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1058" } docComment = """ A boolean value, either [true] or [false]. @@ -197,9 +197,9 @@ alias { properties = Map() methods = Map("xor", new { location { - line = 1066 + line = 1068 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1066" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1068" } docComment = """ Tells if exactly one of [this] and [other] is [true] (exclusive or). @@ -221,9 +221,9 @@ alias { }) }, "implies", new { location { - line = 1079 + line = 1081 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1079" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1081" } docComment = """ Tells if [this] implies [other] (logical consequence). @@ -251,9 +251,9 @@ alias { }, new { referent { location { - line = 1092 + line = 1094 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1092" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1094" } docComment = """ A sequence of Unicode characters (code points). @@ -433,9 +433,9 @@ alias { } properties = Map("length", new { location { - line = 1103 + line = 1105 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1103" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1105" } docComment = """ The number of characters in this string. @@ -458,9 +458,9 @@ alias { name = "length" }, "lastIndex", new { location { - line = 1116 + line = 1118 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1116" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1118" } docComment = """ The index of the last character in this string (same as `length - 1`). @@ -480,9 +480,9 @@ alias { name = "lastIndex" }, "isEmpty", new { location { - line = 1126 + line = 1128 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1126" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1128" } docComment = """ Tells whether this string is empty. @@ -499,9 +499,9 @@ alias { name = "isEmpty" }, "isBlank", new { location { - line = 1137 + line = 1139 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1137" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1139" } docComment = """ Tells if all characters in this string have Unicode property "White_Space". @@ -519,9 +519,9 @@ alias { name = "isBlank" }, "isRegex", new { location { - line = 1140 + line = 1142 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1140" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1142" } docComment = "Tells if this string is a valid regular expression according to [Regex]." annotations = List() @@ -529,9 +529,9 @@ alias { name = "isRegex" }, "isBase64", new { location { - line = 1150 + line = 1152 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1150" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1152" } docComment = """ Tells if this is a valid base64-encoded string. @@ -549,9 +549,9 @@ alias { name = "isBase64" }, "md5", new { location { - line = 1157 + line = 1159 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1157" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1159" } docComment = """ The [MD5](https://en.wikipedia.org/wiki/MD5) @@ -565,9 +565,9 @@ alias { name = "md5" }, "sha1", new { location { - line = 1163 + line = 1165 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1163" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1165" } docComment = """ The [SHA-1](https://en.wikipedia.org/wiki/SHA-1) @@ -580,9 +580,9 @@ alias { name = "sha1" }, "sha256", new { location { - line = 1168 + line = 1170 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1168" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1170" } docComment = """ The [SHA-256](https://en.wikipedia.org/wiki/SHA-2) @@ -594,9 +594,9 @@ alias { name = "sha256" }, "sha256Int", new { location { - line = 1172 + line = 1174 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1172" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1174" } docComment = """ The first 64 bits of the [SHA-256](https://en.wikipedia.org/wiki/SHA-2) @@ -607,9 +607,9 @@ alias { name = "sha256Int" }, "base64", new { location { - line = 1175 + line = 1177 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1175" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1177" } docComment = "The Base64 encoding of this string's UTF-8 byte sequence." annotations = List() @@ -617,9 +617,9 @@ alias { name = "base64" }, "base64Decoded", new { location { - line = 1183 + line = 1185 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1183" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1185" } docComment = """ The inverse of [base64]. @@ -634,9 +634,9 @@ alias { name = "base64Decoded" }, "base64DecodedBytes", new { location { - line = 1192 + line = 1194 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1192" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1194" } docComment = """ Converts this base64-format string into [Bytes]. @@ -653,9 +653,9 @@ alias { name = "base64DecodedBytes" }, "chars", new { location { - line = 1200 + line = 1202 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1200" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1202" } docComment = """ The Unicode characters in this string. @@ -670,9 +670,9 @@ alias { name = "chars" }, "codePoints", new { location { - line = 1208 + line = 1210 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1208" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1210" } docComment = """ The Unicode code points in this string. @@ -688,9 +688,9 @@ alias { }) methods = Map("getOrNull", new { location { - line = 1220 + line = 1222 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1220" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1222" } docComment = """ Returns the character at [index], or [null] if [index] is out of range. @@ -713,9 +713,9 @@ alias { }) }, "substring", new { location { - line = 1234 + line = 1236 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1234" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1236" } docComment = """ Returns the substring from [start] until [exclusiveEnd]. @@ -742,9 +742,9 @@ alias { }) }, "substringOrNull", new { location { - line = 1252 + line = 1254 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1252" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1254" } docComment = """ Returns the substring from [start] until [exclusiveEnd]. @@ -775,9 +775,9 @@ alias { }) }, "repeat", new { location { - line = 1262 + line = 1264 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1262" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1264" } docComment = """ Concatenates [count] copies of this string. @@ -798,9 +798,9 @@ alias { }) }, "contains", new { location { - line = 1265 + line = 1267 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1265" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1267" } docComment = "Tells whether this string contains [pattern]." annotations = List() @@ -812,9 +812,9 @@ alias { }) }, "matches", new { location { - line = 1269 + line = 1271 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1269" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1271" } docComment = "Tells whether this string matches [regex] in its entirety." annotations = List(new { @@ -830,9 +830,9 @@ alias { }) }, "startsWith", new { location { - line = 1272 + line = 1274 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1272" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1274" } docComment = "Tells whether this string starts with [pattern]." annotations = List() @@ -844,9 +844,9 @@ alias { }) }, "endsWith", new { location { - line = 1275 + line = 1277 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1275" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1277" } docComment = "Tells whether this string ends with [pattern]." annotations = List() @@ -858,9 +858,9 @@ alias { }) }, "indexOf", new { location { - line = 1281 + line = 1283 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1281" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1283" } docComment = """ Returns the zero-based index of the first occurrence of [pattern] @@ -877,9 +877,9 @@ alias { }) }, "indexOfOrNull", new { location { - line = 1285 + line = 1287 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1285" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1287" } docComment = """ Returns the zero-based index of the first occurrence of [pattern] @@ -894,9 +894,9 @@ alias { }) }, "lastIndexOf", new { location { - line = 1291 + line = 1293 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1291" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1293" } docComment = """ Returns the zero-based index of the last occurrence of [pattern] @@ -913,9 +913,9 @@ alias { }) }, "lastIndexOfOrNull", new { location { - line = 1295 + line = 1297 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1295" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1297" } docComment = """ Returns the zero-based index of the last occurrence of [pattern] @@ -930,9 +930,9 @@ alias { }) }, "take", new { location { - line = 1301 + line = 1303 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1301" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1303" } docComment = """ Returns the first [n] characters of this string. @@ -952,9 +952,9 @@ alias { }) }, "takeWhile", new { location { - line = 1304 + line = 1306 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1304" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1306" } docComment = "Returns the longest prefix of this string that satisfies [predicate]." annotations = List() @@ -966,9 +966,9 @@ alias { }) }, "takeLast", new { location { - line = 1309 + line = 1311 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1309" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1311" } docComment = """ Returns the last [n] characters of this string. @@ -984,9 +984,9 @@ alias { }) }, "takeLastWhile", new { location { - line = 1312 + line = 1314 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1312" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1314" } docComment = "Returns the longest suffix of this string that satisfies [predicate]." annotations = List() @@ -998,9 +998,9 @@ alias { }) }, "drop", new { location { - line = 1318 + line = 1320 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1318" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1320" } docComment = """ Removes the first [n] characters of this string. @@ -1020,9 +1020,9 @@ alias { }) }, "dropWhile", new { location { - line = 1322 + line = 1324 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1322" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1324" } docComment = "Removes the longest prefix of this string that satisfies [predicate]." annotations = List(new { @@ -1038,9 +1038,9 @@ alias { }) }, "dropLast", new { location { - line = 1328 + line = 1330 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1328" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1330" } docComment = """ Removes the last [n] characters of this string. @@ -1060,9 +1060,9 @@ alias { }) }, "dropLastWhile", new { location { - line = 1332 + line = 1334 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1332" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1334" } docComment = "Removes the longest suffix of this string that satisfies [predicate]." annotations = List(new { @@ -1078,9 +1078,9 @@ alias { }) }, "replaceFirst", new { location { - line = 1337 + line = 1339 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1337" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1339" } docComment = """ Replaces the first occurrence of [pattern] in this string with [replacement]. @@ -1098,9 +1098,9 @@ alias { }) }, "replaceLast", new { location { - line = 1342 + line = 1344 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1342" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1344" } docComment = """ Replaces the last occurrence of [pattern] in this string with [replacement]. @@ -1118,9 +1118,9 @@ alias { }) }, "replaceAll", new { location { - line = 1347 + line = 1349 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1347" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1349" } docComment = """ Replaces all occurrences of [pattern] in this string with [replacement]. @@ -1138,9 +1138,9 @@ alias { }) }, "replaceFirstMapped", new { location { - line = 1352 + line = 1354 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1352" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1354" } docComment = """ Replaces the first occurrence of [pattern] in this string with the return value of [mapper]. @@ -1158,9 +1158,9 @@ alias { }) }, "replaceLastMapped", new { location { - line = 1357 + line = 1359 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1357" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1359" } docComment = """ Replaces the last occurrence of [pattern] in this string with the return value of [mapper]. @@ -1178,9 +1178,9 @@ alias { }) }, "replaceAllMapped", new { location { - line = 1362 + line = 1364 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1362" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1364" } docComment = """ Replaces all occurrences of [pattern] in this string with the return value of [mapper]. @@ -1198,9 +1198,9 @@ alias { }) }, "replaceRange", new { location { - line = 1367 + line = 1369 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1367" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1369" } docComment = """ Replaces the characters between [start] and [exclusiveEnd] with [replacement]. @@ -1220,9 +1220,9 @@ alias { }) }, "toUpperCase", new { location { - line = 1370 + line = 1372 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1370" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1372" } docComment = "Performs a locale-independent character-by-character conversion of this string to uppercase." annotations = List() @@ -1232,9 +1232,9 @@ alias { parameters = Map() }, "toLowerCase", new { location { - line = 1373 + line = 1375 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1373" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1375" } docComment = "Performs a locale-independent character-by-character conversion of this string to lowercase." annotations = List() @@ -1244,9 +1244,9 @@ alias { parameters = Map() }, "reverse", new { location { - line = 1376 + line = 1378 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1376" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1378" } docComment = "Reverses the order of characters in this string." annotations = List() @@ -1256,9 +1256,9 @@ alias { parameters = Map() }, "trim", new { location { - line = 1380 + line = 1382 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1380" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1382" } docComment = "Removes any leading and trailing characters with Unicode property \"White_Space\" from this string." annotations = List(new { @@ -1272,9 +1272,9 @@ alias { parameters = Map() }, "trimStart", new { location { - line = 1384 + line = 1386 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1384" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1386" } docComment = "Removes any leading characters with Unicode property \"White_Space\" from this string." annotations = List(new { @@ -1292,9 +1292,9 @@ alias { parameters = Map() }, "trimEnd", new { location { - line = 1388 + line = 1390 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1388" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1390" } docComment = "Removes any trailing characters with Unicode property \"White_Space\" from this string." annotations = List(new { @@ -1312,9 +1312,9 @@ alias { parameters = Map() }, "padStart", new { location { - line = 1394 + line = 1396 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1394" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1396" } docComment = """ Increases the length of this string to [width] by adding leading [char]s. @@ -1336,9 +1336,9 @@ alias { }) }, "padEnd", new { location { - line = 1400 + line = 1402 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1400" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1402" } docComment = """ Increases the length of this string to [width] by adding trailing [char]s. @@ -1360,9 +1360,9 @@ alias { }) }, "split", new { location { - line = 1403 + line = 1405 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1403" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1405" } docComment = "Splits this string around matches of [pattern]." annotations = List() @@ -1374,9 +1374,9 @@ alias { }) }, "splitLimit", new { location { - line = 1418 + line = 1420 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1418" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1420" } docComment = """ Splits this string matches of [pattern], up to [limit] substrings. @@ -1405,9 +1405,9 @@ alias { }) }, "capitalize", new { location { - line = 1428 + line = 1430 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1428" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1430" } docComment = """ Converts the first character of this string to title case. @@ -1426,9 +1426,9 @@ alias { parameters = Map() }, "decapitalize", new { location { - line = 1438 + line = 1440 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1438" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1440" } docComment = """ Converts the first character of this string to lower case. @@ -1447,9 +1447,9 @@ alias { parameters = Map() }, "toInt", new { location { - line = 1444 + line = 1446 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1444" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1446" } docComment = """ Parses this string as a signed decimal (base 10) integer. @@ -1464,9 +1464,9 @@ alias { parameters = Map() }, "toIntOrNull", new { location { - line = 1450 + line = 1452 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1450" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1452" } docComment = """ Parses this string as a signed decimal (base 10) integer. @@ -1481,9 +1481,9 @@ alias { parameters = Map() }, "toFloat", new { location { - line = 1455 + line = 1457 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1455" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1457" } docComment = """ Parses this string as a floating point number. @@ -1497,9 +1497,9 @@ alias { parameters = Map() }, "toFloatOrNull", new { location { - line = 1460 + line = 1462 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1460" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1462" } docComment = """ Parses this string as a floating point number. @@ -1513,9 +1513,9 @@ alias { parameters = Map() }, "toBoolean", new { location { - line = 1465 + line = 1467 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1465" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1467" } docComment = """ Parses `"true"` to [true] and `"false"` to [false] (case-insensitive). @@ -1529,9 +1529,9 @@ alias { parameters = Map() }, "toBooleanOrNull", new { location { - line = 1470 + line = 1472 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1470" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1472" } docComment = """ Parses `"true"` to [true] and `"false"` to [false] (case-insensitive). @@ -1545,9 +1545,9 @@ alias { parameters = Map() }, "encodeToBytes", new { location { - line = 1479 + line = 1481 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1479" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1481" } docComment = """ Returns the bytes of this string, encoded using [charset]. @@ -1586,9 +1586,9 @@ rec { typeParameters = List() superclass { location { - line = 1773 + line = 1775 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1773" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1775" } docComment = """ Base class for objects whose members are described by a class definition. @@ -1601,9 +1601,9 @@ rec { typeParameters = List() superclass { location { - line = 1768 + line = 1770 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1768" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1770" } docComment = """ A composite value containing members (properties, elements, entries). @@ -1827,9 +1827,9 @@ rec { supertype { referent { location { - line = 1768 + line = 1770 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1768" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1770" } docComment = """ A composite value containing members (properties, elements, entries). @@ -2055,9 +2055,9 @@ rec { properties = Map() methods = Map("hasProperty", new { location { - line = 1775 + line = 1777 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1775" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1777" } docComment = "Tells if this object has a property with the given [name]." annotations = List() @@ -2069,9 +2069,9 @@ rec { }) }, "getProperty", new { location { - line = 1780 + line = 1782 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1780" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1782" } docComment = """ Returns the value of the property with the given [name]. @@ -2087,9 +2087,9 @@ rec { }) }, "getPropertyOrNull", new { location { - line = 1785 + line = 1787 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1785" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1787" } docComment = """ Returns the value of the property with the given [name]. @@ -2105,9 +2105,9 @@ rec { }) }, "toDynamic", new { location { - line = 1788 + line = 1790 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1788" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1790" } docComment = "Converts this object to a [Dynamic] object." annotations = List() @@ -2117,9 +2117,9 @@ rec { parameters = Map() }, "toMap", new { location { - line = 1791 + line = 1793 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1791" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1793" } docComment = "Converts this object to a [Map]." annotations = List() @@ -2132,9 +2132,9 @@ rec { supertype { referent { location { - line = 1773 + line = 1775 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1773" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1775" } docComment = """ Base class for objects whose members are described by a class definition. @@ -2147,9 +2147,9 @@ rec { typeParameters = List() superclass { location { - line = 1768 + line = 1770 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1768" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1770" } docComment = """ A composite value containing members (properties, elements, entries). @@ -2373,9 +2373,9 @@ rec { supertype { referent { location { - line = 1768 + line = 1770 column = 1 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1768" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1770" } docComment = """ A composite value containing members (properties, elements, entries). @@ -2601,9 +2601,9 @@ rec { properties = Map() methods = Map("hasProperty", new { location { - line = 1775 + line = 1777 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1775" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1777" } docComment = "Tells if this object has a property with the given [name]." annotations = List() @@ -2615,9 +2615,9 @@ rec { }) }, "getProperty", new { location { - line = 1780 + line = 1782 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1780" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1782" } docComment = """ Returns the value of the property with the given [name]. @@ -2633,9 +2633,9 @@ rec { }) }, "getPropertyOrNull", new { location { - line = 1785 + line = 1787 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1785" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1787" } docComment = """ Returns the value of the property with the given [name]. @@ -2651,9 +2651,9 @@ rec { }) }, "toDynamic", new { location { - line = 1788 + line = 1790 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1788" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1790" } docComment = "Converts this object to a [Dynamic] object." annotations = List() @@ -2663,9 +2663,9 @@ rec { parameters = Map() }, "toMap", new { location { - line = 1791 + line = 1793 column = 3 - displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1791" + displayUri = "https://github.com/apple/pkl/blob/$commitId/stdlib/base.pkl#L1793" } docComment = "Converts this object to a [Map]." annotations = List() diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/basic/read.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/basic/read.pcf index 4c1a387d..733f2e77 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/basic/read.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/basic/read.pcf @@ -22,7 +22,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } "Cannot find resource `other.txt`." new { @@ -31,7 +31,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } null } @@ -42,7 +42,7 @@ examples { resource """ - bytes = Bytes(114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "cmVzb3VyY2UK" } new { uri = "file:///$snippetsDir/input-helper/basic/read/resource.txt" @@ -50,7 +50,7 @@ examples { resource """ - bytes = Bytes(114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "cmVzb3VyY2UK" } } ["read non-allowed resource"] { @@ -64,7 +64,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } new { uri = "file:///$snippetsDir/input/basic/globtest/file2.txt" @@ -72,7 +72,7 @@ examples { file2 """ - bytes = Bytes(102, 105, 108, 101, 50, 10) + base64 = "ZmlsZTIK" } } ["read different resources with same relative resource URI"] { @@ -82,7 +82,7 @@ examples { resource """ - bytes = Bytes(114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "cmVzb3VyY2UK" } new { uri = "file:///$snippetsDir/input-helper/basic/read/child/resource.txt" @@ -90,7 +90,7 @@ examples { child resource """ - bytes = Bytes(99, 104, 105, 108, 100, 32, 114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "Y2hpbGQgcmVzb3VyY2UK" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/basic/readGlob.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/basic/readGlob.pcf index 9b52bbf6..c38b647a 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/basic/readGlob.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/basic/readGlob.pcf @@ -4,7 +4,7 @@ examples { ["../../input-helper/globtest/module with [weird] ~!characters.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/module%20with%20%5Bweird%5D%20~!characters.pkl" text = "" - bytes = Bytes() + base64 = "" } ["../../input-helper/globtest/moduleA.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/moduleA.pkl" @@ -12,7 +12,7 @@ examples { name = "moduleA" """ - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 109, 111, 100, 117, 108, 101, 65, 34, 10) + base64 = "bmFtZSA9ICJtb2R1bGVBIgo=" } ["../../input-helper/globtest/moduleB.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/moduleB.pkl" @@ -20,7 +20,7 @@ examples { name = "moduleB" """ - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 109, 111, 100, 117, 108, 101, 66, 34, 10) + base64 = "bmFtZSA9ICJtb2R1bGVCIgo=" } ["../../input-helper/globtest/child/moduleC.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/child/moduleC.pkl" @@ -28,7 +28,7 @@ examples { name = "child/moduleC" """ - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 99, 104, 105, 108, 100, 47, 109, 111, 100, 117, 108, 101, 67, 34, 10) + base64 = "bmFtZSA9ICJjaGlsZC9tb2R1bGVDIgo=" } } new { @@ -38,7 +38,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } ["globtest/file2.txt"] { uri = "file:///$snippetsDir/input/basic/globtest/file2.txt" @@ -46,7 +46,7 @@ examples { file2 """ - bytes = Bytes(102, 105, 108, 101, 50, 10) + base64 = "ZmlsZTIK" } } } @@ -55,22 +55,22 @@ examples { ["../../input-helper/globtest/module with [weird] ~!characters.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/module%20with%20%5Bweird%5D%20~!characters.pkl" text = "hi" - bytes = Bytes() + base64 = "" } ["../../input-helper/globtest/moduleA.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/moduleA.pkl" text = "hi" - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 109, 111, 100, 117, 108, 101, 65, 34, 10) + base64 = "bmFtZSA9ICJtb2R1bGVBIgo=" } ["../../input-helper/globtest/moduleB.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/moduleB.pkl" text = "hi" - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 109, 111, 100, 117, 108, 101, 66, 34, 10) + base64 = "bmFtZSA9ICJtb2R1bGVCIgo=" } ["../../input-helper/globtest/child/moduleC.pkl"] { uri = "file:///$snippetsDir/input-helper/globtest/child/moduleC.pkl" text = "hi" - bytes = Bytes(110, 97, 109, 101, 32, 61, 32, 34, 99, 104, 105, 108, 100, 47, 109, 111, 100, 117, 108, 101, 67, 34, 10) + base64 = "bmFtZSA9ICJjaGlsZC9tb2R1bGVDIgo=" } } } @@ -132,7 +132,7 @@ examples { favoriteFruit: Fruit """ - bytes = Bytes(111, 112, 101, 110, 32, 109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 66, 105, 114, 100, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 70, 114, 117, 105, 116, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 58, 32, 83, 116, 114, 105, 110, 103, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 58, 32, 70, 114, 117, 105, 116, 10) + base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" } ["package://localhost:0/birds@0.5.0#/allFruit.pkl"] { uri = "package://localhost:0/birds@0.5.0#/allFruit.pkl" @@ -143,7 +143,7 @@ examples { fruitFiles = read*("@fruities/catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 97, 108, 108, 70, 114, 117, 105, 116, 10, 10, 102, 114, 117, 105, 116, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 102, 114, 117, 105, 116, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" } ["package://localhost:0/birds@0.5.0#/catalog.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog.pkl" @@ -154,7 +154,7 @@ examples { catalogFiles = read*("catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 99, 97, 116, 97, 108, 111, 103, 10, 10, 99, 97, 116, 97, 108, 111, 103, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 99, 97, 116, 97, 108, 111, 103, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo=" } ["package://localhost:0/birds@0.5.0#/catalog/Ostrich.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog/Ostrich.pkl" @@ -168,7 +168,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -182,7 +182,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } ["package://localhost:0/birds@0.5.0#/some/dir/Bird.pkl"] { uri = "package://localhost:0/birds@0.5.0#/some/dir/Bird.pkl" @@ -196,7 +196,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 46, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 66, 105, 114, 100, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 70, 114, 117, 105, 116, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi4iCgpuYW1lID0gIkJpcmQiCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIkZydWl0Igp9Cg==" } } } @@ -208,7 +208,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } ["globtest/file2.txt"] { uri = "file:///$snippetsDir/input/basic/globtest/file2.txt" @@ -216,7 +216,7 @@ examples { file2 """ - bytes = Bytes(102, 105, 108, 101, 50, 10) + base64 = "ZmlsZTIK" } } new { @@ -226,7 +226,7 @@ examples { file1 """ - bytes = Bytes(102, 105, 108, 101, 49, 10) + base64 = "ZmlsZTEK" } } new { @@ -236,7 +236,7 @@ examples { file2 """ - bytes = Bytes(102, 105, 108, 101, 50, 10) + base64 = "ZmlsZTIK" } } } @@ -248,7 +248,7 @@ examples { resource """ - bytes = Bytes(114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "cmVzb3VyY2UK" } } new { @@ -258,7 +258,7 @@ examples { child resource """ - bytes = Bytes(99, 104, 105, 108, 100, 32, 114, 101, 115, 111, 117, 114, 99, 101, 10) + base64 = "Y2hpbGQgcmVzb3VyY2UK" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages1.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages1.pcf index bfbff47a..ca1d8c68 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages1.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages1.pcf @@ -40,7 +40,7 @@ examples { favoriteFruit: Fruit """ - bytes = Bytes(111, 112, 101, 110, 32, 109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 66, 105, 114, 100, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 70, 114, 117, 105, 116, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 58, 32, 83, 116, 114, 105, 110, 103, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 58, 32, 70, 114, 117, 105, 116, 10) + base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" } new { uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -54,7 +54,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } new { uri = "package://localhost:0/birds@0.5.0#/catalog/Ostrich.pkl" @@ -68,7 +68,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages2.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages2.pcf index 15239c6b..d4dfd5f0 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages2.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/packages/packages2.pcf @@ -52,7 +52,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -66,7 +66,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } } } @@ -84,7 +84,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["catalog/Swallow.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -98,7 +98,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } } } @@ -112,7 +112,7 @@ examples { name = "Apple" """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 70, 114, 117, 105, 116, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 65, 112, 112, 108, 101, 34, 10) + base64 = "YW1lbmRzICIuLi9GcnVpdC5wa2wiCgpuYW1lID0gIkFwcGxlIgo=" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/basic.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/basic.pcf index 8fd7f6af..44be0a5d 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/basic.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/basic.pcf @@ -44,7 +44,7 @@ examples { Swallow.pkl """ - bytes = Bytes(79, 115, 116, 114, 105, 99, 104, 46, 112, 107, 108, 10, 83, 119, 97, 108, 108, 111, 119, 46, 112, 107, 108, 10) + base64 = "T3N0cmljaC5wa2wKU3dhbGxvdy5wa2wK" } new { uri = "projectpackage://localhost:0/birds@0.5.0#/" @@ -56,7 +56,7 @@ examples { some """ - bytes = Bytes(66, 105, 114, 100, 46, 112, 107, 108, 10, 97, 108, 108, 70, 114, 117, 105, 116, 46, 112, 107, 108, 10, 99, 97, 116, 97, 108, 111, 103, 10, 99, 97, 116, 97, 108, 111, 103, 46, 112, 107, 108, 10, 115, 111, 109, 101, 10) + base64 = "QmlyZC5wa2wKYWxsRnJ1aXQucGtsCmNhdGFsb2cKY2F0YWxvZy5wa2wKc29tZQo=" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/globbing.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/globbing.pcf index d9cfccdf..bf425325 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/globbing.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/globbing.pcf @@ -62,7 +62,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["@birds/catalog/Swallow.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -76,7 +76,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } } new { @@ -92,7 +92,7 @@ examples { favoriteFruit: Fruit """ - bytes = Bytes(111, 112, 101, 110, 32, 109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 66, 105, 114, 100, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 70, 114, 117, 105, 116, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 58, 32, 83, 116, 114, 105, 110, 103, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 58, 32, 70, 114, 117, 105, 116, 10) + base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" } ["@birds/allFruit.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/allFruit.pkl" @@ -103,7 +103,7 @@ examples { fruitFiles = read*("@fruities/catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 97, 108, 108, 70, 114, 117, 105, 116, 10, 10, 102, 114, 117, 105, 116, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 102, 114, 117, 105, 116, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" } ["@birds/catalog.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog.pkl" @@ -114,7 +114,7 @@ examples { catalogFiles = read*("catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 99, 97, 116, 97, 108, 111, 103, 10, 10, 99, 97, 116, 97, 108, 111, 103, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 99, 97, 116, 97, 108, 111, 103, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo=" } } new { @@ -130,7 +130,7 @@ examples { favoriteFruit: Fruit """ - bytes = Bytes(111, 112, 101, 110, 32, 109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 66, 105, 114, 100, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 70, 114, 117, 105, 116, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 58, 32, 83, 116, 114, 105, 110, 103, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 58, 32, 70, 114, 117, 105, 116, 10) + base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" } ["@birds/allFruit.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/allFruit.pkl" @@ -141,7 +141,7 @@ examples { fruitFiles = read*("@fruities/catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 97, 108, 108, 70, 114, 117, 105, 116, 10, 10, 102, 114, 117, 105, 116, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 102, 114, 117, 105, 116, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" } ["@birds/catalog.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog.pkl" @@ -152,7 +152,7 @@ examples { catalogFiles = read*("catalog/*.pkl") """ - bytes = Bytes(109, 111, 100, 117, 108, 101, 32, 98, 105, 114, 100, 115, 46, 99, 97, 116, 97, 108, 111, 103, 10, 10, 99, 97, 116, 97, 108, 111, 103, 32, 61, 32, 105, 109, 112, 111, 114, 116, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10, 99, 97, 116, 97, 108, 111, 103, 70, 105, 108, 101, 115, 32, 61, 32, 114, 101, 97, 100, 42, 40, 34, 99, 97, 116, 97, 108, 111, 103, 47, 42, 46, 112, 107, 108, 34, 41, 10) + base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo=" } ["@birds/catalog/Ostrich.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Ostrich.pkl" @@ -166,7 +166,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["@birds/catalog/Swallow.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -180,7 +180,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } ["@birds/some/dir/Bird.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/some/dir/Bird.pkl" @@ -194,7 +194,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 46, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 66, 105, 114, 100, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 70, 114, 117, 105, 116, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi4iCgpuYW1lID0gIkJpcmQiCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIkZydWl0Igp9Cg==" } } } @@ -212,7 +212,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["catalog/Swallow.pkl"] { uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -226,7 +226,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } } } @@ -244,7 +244,7 @@ examples { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 79, 115, 116, 114, 105, 99, 104, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 79, 114, 97, 110, 103, 101, 34, 10, 125, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cmljaCIKCmZhdm9yaXRlRnJ1aXQgewogIG5hbWUgPSAiT3JhbmdlIgp9Cg==" } ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] { uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl" @@ -258,7 +258,7 @@ examples { favoriteFruit = apple """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 46, 46, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 105, 109, 112, 111, 114, 116, 32, 34, 64, 102, 114, 117, 105, 116, 105, 101, 115, 47, 99, 97, 116, 97, 108, 111, 103, 47, 97, 112, 112, 108, 101, 46, 112, 107, 108, 34, 10, 10, 110, 97, 109, 101, 32, 61, 32, 34, 83, 119, 97, 108, 108, 111, 119, 34, 10, 10, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 61, 32, 97, 112, 112, 108, 101, 10) + base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" } } } diff --git a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/localProjectRead.pcf b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/localProjectRead.pcf index 032afe2a..d63015a0 100644 --- a/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/localProjectRead.pcf +++ b/pkl-core/src/test/files/LanguageSnippetTests/output/projects/project1/localProjectRead.pcf @@ -29,7 +29,7 @@ res2 { } """ - bytes = Bytes(97, 109, 101, 110, 100, 115, 32, 34, 112, 107, 108, 58, 80, 114, 111, 106, 101, 99, 116, 34, 10, 10, 112, 97, 99, 107, 97, 103, 101, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 112, 114, 111, 106, 101, 99, 116, 50, 34, 10, 32, 32, 98, 97, 115, 101, 85, 114, 105, 32, 61, 32, 34, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 112, 114, 111, 106, 101, 99, 116, 50, 34, 10, 32, 32, 118, 101, 114, 115, 105, 111, 110, 32, 61, 32, 34, 49, 46, 48, 46, 48, 34, 10, 32, 32, 112, 97, 99, 107, 97, 103, 101, 90, 105, 112, 85, 114, 108, 32, 61, 32, 34, 104, 116, 116, 112, 115, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 112, 114, 111, 106, 101, 99, 116, 50, 47, 112, 114, 111, 106, 101, 99, 116, 50, 45, 92, 40, 118, 101, 114, 115, 105, 111, 110, 41, 46, 122, 105, 112, 34, 10, 125, 10, 10, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 32, 123, 10, 32, 32, 91, 34, 98, 117, 114, 100, 115, 34, 93, 32, 123, 10, 32, 32, 32, 32, 117, 114, 105, 32, 61, 32, 34, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 98, 105, 114, 100, 115, 64, 48, 46, 53, 46, 48, 34, 10, 32, 32, 125, 10, 125, 10) + base64 = "YW1lbmRzICJwa2w6UHJvamVjdCIKCnBhY2thZ2UgewogIG5hbWUgPSAicHJvamVjdDIiCiAgYmFzZVVyaSA9ICJwYWNrYWdlOi8vbG9jYWxob3N0OjAvcHJvamVjdDIiCiAgdmVyc2lvbiA9ICIxLjAuMCIKICBwYWNrYWdlWmlwVXJsID0gImh0dHBzOi8vbG9jYWxob3N0OjAvcHJvamVjdDIvcHJvamVjdDItXCh2ZXJzaW9uKS56aXAiCn0KCmRlcGVuZGVuY2llcyB7CiAgWyJidXJkcyJdIHsKICAgIHVyaSA9ICJwYWNrYWdlOi8vbG9jYWxob3N0OjAvYmlyZHNAMC41LjAiCiAgfQp9Cg==" } ["@project2/PklProject.deps.json"] { uri = "file:/$snippetsDir/input/projects/project2/PklProject.deps.json" @@ -55,7 +55,7 @@ res2 { } """ - bytes = Bytes(123, 10, 32, 32, 34, 115, 99, 104, 101, 109, 97, 86, 101, 114, 115, 105, 111, 110, 34, 58, 32, 49, 44, 10, 32, 32, 34, 114, 101, 115, 111, 108, 118, 101, 100, 68, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 34, 58, 32, 123, 10, 32, 32, 32, 32, 34, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 98, 105, 114, 100, 115, 64, 48, 34, 58, 32, 123, 10, 32, 32, 32, 32, 32, 32, 34, 116, 121, 112, 101, 34, 58, 32, 34, 114, 101, 109, 111, 116, 101, 34, 44, 10, 32, 32, 32, 32, 32, 32, 34, 117, 114, 105, 34, 58, 32, 34, 112, 114, 111, 106, 101, 99, 116, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 98, 105, 114, 100, 115, 64, 48, 46, 53, 46, 48, 34, 44, 10, 32, 32, 32, 32, 32, 32, 34, 99, 104, 101, 99, 107, 115, 117, 109, 115, 34, 58, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 34, 115, 104, 97, 50, 53, 54, 34, 58, 32, 34, 36, 115, 107, 105, 112, 67, 104, 101, 99, 107, 115, 117, 109, 86, 101, 114, 105, 102, 105, 99, 97, 116, 105, 111, 110, 34, 10, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 125, 44, 10, 32, 32, 32, 32, 34, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 102, 114, 117, 105, 116, 64, 49, 34, 58, 32, 123, 10, 32, 32, 32, 32, 32, 32, 34, 116, 121, 112, 101, 34, 58, 32, 34, 114, 101, 109, 111, 116, 101, 34, 44, 10, 32, 32, 32, 32, 32, 32, 34, 117, 114, 105, 34, 58, 32, 34, 112, 114, 111, 106, 101, 99, 116, 112, 97, 99, 107, 97, 103, 101, 58, 47, 47, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 48, 47, 102, 114, 117, 105, 116, 64, 49, 46, 49, 46, 48, 34, 44, 10, 32, 32, 32, 32, 32, 32, 34, 99, 104, 101, 99, 107, 115, 117, 109, 115, 34, 58, 32, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 34, 115, 104, 97, 50, 53, 54, 34, 58, 32, 34, 36, 115, 107, 105, 112, 67, 104, 101, 99, 107, 115, 117, 109, 86, 101, 114, 105, 102, 105, 99, 97, 116, 105, 111, 110, 34, 10, 32, 32, 32, 32, 32, 32, 125, 10, 32, 32, 32, 32, 125, 10, 32, 32, 125, 10, 125, 10) + base64 = "ewogICJzY2hlbWFWZXJzaW9uIjogMSwKICAicmVzb2x2ZWREZXBlbmRlbmNpZXMiOiB7CiAgICAicGFja2FnZTovL2xvY2FsaG9zdDowL2JpcmRzQDAiOiB7CiAgICAgICJ0eXBlIjogInJlbW90ZSIsCiAgICAgICJ1cmkiOiAicHJvamVjdHBhY2thZ2U6Ly9sb2NhbGhvc3Q6MC9iaXJkc0AwLjUuMCIsCiAgICAgICJjaGVja3N1bXMiOiB7CiAgICAgICAgInNoYTI1NiI6ICIkc2tpcENoZWNrc3VtVmVyaWZpY2F0aW9uIgogICAgICB9CiAgICB9LAogICAgInBhY2thZ2U6Ly9sb2NhbGhvc3Q6MC9mcnVpdEAxIjogewogICAgICAidHlwZSI6ICJyZW1vdGUiLAogICAgICAidXJpIjogInByb2plY3RwYWNrYWdlOi8vbG9jYWxob3N0OjAvZnJ1aXRAMS4xLjAiLAogICAgICAiY2hlY2tzdW1zIjogewogICAgICAgICJzaGEyNTYiOiAiJHNraXBDaGVja3N1bVZlcmlmaWNhdGlvbiIKICAgICAgfQogICAgfQogIH0KfQo=" } ["@project2/penguin.pkl"] { uri = "file:/$snippetsDir/input/projects/project2/penguin.pkl" @@ -70,6 +70,6 @@ res2 { } """ - bytes = Bytes(105, 109, 112, 111, 114, 116, 32, 34, 64, 98, 117, 114, 100, 115, 47, 66, 105, 114, 100, 46, 112, 107, 108, 34, 10, 10, 98, 105, 114, 100, 58, 32, 66, 105, 114, 100, 32, 61, 32, 110, 101, 119, 32, 123, 10, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 80, 101, 110, 103, 117, 105, 110, 34, 10, 32, 32, 102, 97, 118, 111, 114, 105, 116, 101, 70, 114, 117, 105, 116, 32, 123, 10, 32, 32, 32, 32, 110, 97, 109, 101, 32, 61, 32, 34, 73, 99, 101, 32, 70, 114, 117, 105, 116, 34, 10, 32, 32, 125, 10, 125, 10) + base64 = "aW1wb3J0ICJAYnVyZHMvQmlyZC5wa2wiCgpiaXJkOiBCaXJkID0gbmV3IHsKICBuYW1lID0gIlBlbmd1aW4iCiAgZmF2b3JpdGVGcnVpdCB7CiAgICBuYW1lID0gIkljZSBGcnVpdCIKICB9Cn0K" } } diff --git a/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt b/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt index 6d644d9b..21a5c320 100644 --- a/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt +++ b/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt @@ -632,7 +632,7 @@ abstract class AbstractServerTest { content $tripleQuote - bytes = Bytes(99, 111, 110, 116, 101, 110, 116, 10) + base64 = "Y29udGVudAo=" } res2 { uri = "modulepath:/dir1/resource1.txt" @@ -640,7 +640,7 @@ abstract class AbstractServerTest { content $tripleQuote - bytes = Bytes(99, 111, 110, 116, 101, 110, 116, 10) + base64 = "Y29udGVudAo=" } res3 { ressy = "the module2 output" diff --git a/stdlib/base.pkl b/stdlib/base.pkl index d0107bc8..72d6961c 100644 --- a/stdlib/base.pkl +++ b/stdlib/base.pkl @@ -513,6 +513,9 @@ class PropertiesRenderer extends ValueRenderer { /// An external (file, HTTP, etc.) resource. /// /// Usually, a [Resource] is obtained via a `read()` expression, such as `read("some/file")`. +/// +/// When created directly, either of [bytes] or [base64] can be set, and the other will be +/// computed in terms of the set value. class Resource { /// The URI of this resource. uri: Uri @@ -520,13 +523,12 @@ class Resource { /// The text content of this resource. text: String + /// The content of this resource in Base64 encoding. + base64: String = bytes.base64 + /// The bytes of this resource. @Since { version = "0.29.0" } - bytes: Bytes - - /// The content of this resource in Base64. - @Deprecated { since = "0.29.0"; message = "Use bytes.base64 instead" } - hidden base64: String = bytes.base64 + hidden bytes: Bytes = base64.base64DecodedBytes /// The [MD5](https://en.wikipedia.org/wiki/MD5) /// hash of this resource as hexadecimal string.