Skip to content

Commit a222013

Browse files
committed
add samples testing the length of UTF-8 strings
1 parent a132b2c commit a222013

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

samples/current/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ result: `Err(FailedLogic(Unauthorized { policy: Allow(0), checks: [Block(FailedB
12141214
### token
12151215

12161216
authority:
1217-
symbols: ["hello world", "hello", "world", "aaabde", "a*c?.e", "abd", "aaa", "b", "de", "abcD12", "abc", "def"]
1217+
symbols: ["hello world", "hello", "world", "aaabde", "a*c?.e", "abd", "aaa", "b", "de", "abcD12", "é", "abc", "def"]
12181218

12191219
public keys: []
12201220

@@ -1239,6 +1239,8 @@ check if "aaabde".matches("a*c?.e");
12391239
check if "aaabde".contains("abd");
12401240
check if "aaabde" == "aaa" + "b" + "de";
12411241
check if "abcD12" == "abcD12";
1242+
check if "abcD12".length() == 6;
1243+
check if "é".length() == 2;
12421244
check if 2019-12-04T09:46:41Z < 2020-12-04T09:46:41Z;
12431245
check if 2020-12-04T09:46:41Z > 2019-12-04T09:46:41Z;
12441246
check if 2019-12-04T09:46:41Z <= 2020-12-04T09:46:41Z;
@@ -1268,7 +1270,7 @@ allow if true;
12681270
```
12691271

12701272
revocation ids:
1271-
- `f61b4cb4fc58777fec6c8d39fe62259dc3c78511868236c391e9f67ffd03a3a8b8e3042d4bacce0d5756d053f5afccd4c5e4df0597af44b36bdfab492e5fe50e`
1273+
- `3d5b23b502b3dd920bfb68b9039164d1563bb8927210166fa5c17f41b76b31bb957bc2ed3318452958f658baa2d398fe4cf25c58a27e6c8bc42c9702c8aa1b0c`
12721274

12731275
authorizer world:
12741276
```
@@ -1287,7 +1289,9 @@ World {
12871289
"check if \"aaabde\".contains(\"abd\")",
12881290
"check if \"aaabde\".matches(\"a*c?.e\")",
12891291
"check if \"abcD12\" == \"abcD12\"",
1292+
"check if \"abcD12\".length() == 6",
12901293
"check if \"hello world\".starts_with(\"hello\") && \"hello world\".ends_with(\"world\")",
1294+
"check if \"é\".length() == 2",
12911295
"check if (true || false) && true",
12921296
"check if 1 + 2 * 3 - 4 / 2 == 5",
12931297
"check if 1 < 2",

samples/current/samples.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,12 +1239,13 @@
12391239
"b",
12401240
"de",
12411241
"abcD12",
1242+
"é",
12421243
"abc",
12431244
"def"
12441245
],
12451246
"public_keys": [],
12461247
"external_key": null,
1247-
"code": "check if true;\ncheck if !false;\ncheck if !false && true;\ncheck if false || true;\ncheck if (true || false) && true;\ncheck if true == true;\ncheck if false == false;\ncheck if 1 < 2;\ncheck if 2 > 1;\ncheck if 1 <= 2;\ncheck if 1 <= 1;\ncheck if 2 >= 1;\ncheck if 2 >= 2;\ncheck if 3 == 3;\ncheck if 1 + 2 * 3 - 4 / 2 == 5;\ncheck if \"hello world\".starts_with(\"hello\") && \"hello world\".ends_with(\"world\");\ncheck if \"aaabde\".matches(\"a*c?.e\");\ncheck if \"aaabde\".contains(\"abd\");\ncheck if \"aaabde\" == \"aaa\" + \"b\" + \"de\";\ncheck if \"abcD12\" == \"abcD12\";\ncheck if 2019-12-04T09:46:41Z < 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z > 2019-12-04T09:46:41Z;\ncheck if 2019-12-04T09:46:41Z <= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2019-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z == 2020-12-04T09:46:41Z;\ncheck if hex:12ab == hex:12ab;\ncheck if [1, 2].contains(2);\ncheck if [2019-12-04T09:46:41Z, 2020-12-04T09:46:41Z].contains(2020-12-04T09:46:41Z);\ncheck if [false, true].contains(true);\ncheck if [\"abc\", \"def\"].contains(\"abc\");\ncheck if [hex:12ab, hex:34de].contains(hex:34de);\ncheck if [1, 2].contains([2]);\ncheck if [1, 2] == [1, 2];\ncheck if [1, 2].intersection([2, 3]) == [2];\ncheck if [1, 2].union([2, 3]) == [1, 2, 3];\ncheck if [1, 2, 3].intersection([1, 2]).contains(1);\ncheck if [1, 2, 3].intersection([1, 2]).length() == 2;\n"
1248+
"code": "check if true;\ncheck if !false;\ncheck if !false && true;\ncheck if false || true;\ncheck if (true || false) && true;\ncheck if true == true;\ncheck if false == false;\ncheck if 1 < 2;\ncheck if 2 > 1;\ncheck if 1 <= 2;\ncheck if 1 <= 1;\ncheck if 2 >= 1;\ncheck if 2 >= 2;\ncheck if 3 == 3;\ncheck if 1 + 2 * 3 - 4 / 2 == 5;\ncheck if \"hello world\".starts_with(\"hello\") && \"hello world\".ends_with(\"world\");\ncheck if \"aaabde\".matches(\"a*c?.e\");\ncheck if \"aaabde\".contains(\"abd\");\ncheck if \"aaabde\" == \"aaa\" + \"b\" + \"de\";\ncheck if \"abcD12\" == \"abcD12\";\ncheck if \"abcD12\".length() == 6;\ncheck if \"é\".length() == 2;\ncheck if 2019-12-04T09:46:41Z < 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z > 2019-12-04T09:46:41Z;\ncheck if 2019-12-04T09:46:41Z <= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2019-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z == 2020-12-04T09:46:41Z;\ncheck if hex:12ab == hex:12ab;\ncheck if [1, 2].contains(2);\ncheck if [2019-12-04T09:46:41Z, 2020-12-04T09:46:41Z].contains(2020-12-04T09:46:41Z);\ncheck if [false, true].contains(true);\ncheck if [\"abc\", \"def\"].contains(\"abc\");\ncheck if [hex:12ab, hex:34de].contains(hex:34de);\ncheck if [1, 2].contains([2]);\ncheck if [1, 2] == [1, 2];\ncheck if [1, 2].intersection([2, 3]) == [2];\ncheck if [1, 2].union([2, 3]) == [1, 2, 3];\ncheck if [1, 2, 3].intersection([1, 2]).contains(1);\ncheck if [1, 2, 3].intersection([1, 2]).length() == 2;\n"
12481249
}
12491250
],
12501251
"validations": {
@@ -1262,7 +1263,9 @@
12621263
"check if \"aaabde\".contains(\"abd\")",
12631264
"check if \"aaabde\".matches(\"a*c?.e\")",
12641265
"check if \"abcD12\" == \"abcD12\"",
1266+
"check if \"abcD12\".length() == 6",
12651267
"check if \"hello world\".starts_with(\"hello\") && \"hello world\".ends_with(\"world\")",
1268+
"check if \"é\".length() == 2",
12661269
"check if (true || false) && true",
12671270
"check if 1 + 2 * 3 - 4 / 2 == 5",
12681271
"check if 1 < 2",
@@ -1307,7 +1310,7 @@
13071310
},
13081311
"authorizer_code": "allow if true;\n",
13091312
"revocation_ids": [
1310-
"f61b4cb4fc58777fec6c8d39fe62259dc3c78511868236c391e9f67ffd03a3a8b8e3042d4bacce0d5756d053f5afccd4c5e4df0597af44b36bdfab492e5fe50e"
1313+
"3d5b23b502b3dd920bfb68b9039164d1563bb8927210166fa5c17f41b76b31bb957bc2ed3318452958f658baa2d398fe4cf25c58a27e6c8bc42c9702c8aa1b0c"
13111314
]
13121315
}
13131316
}
74 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)