aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-30 13:02:39 +0100
committereunhhu <[email protected]>2026-09-30 13:02:39 +0100
commitbe1122a2e8bc720bd9473c130255eba46389c883 (patch)
tree3d55ac2444c602516a0c160c02e541b1f20af788 /tests
parentc69682e1f1bc73e2b1f4a22b8eb3ec463be588e3 (diff)
downloadaup-be1122a2e8bc720bd9473c130255eba46389c883.tar.gz
aup-be1122a2e8bc720bd9473c130255eba46389c883.zip
Let declared fields be apart by commas, as a value's are
A message's, a group's and a record's fields took a newline or a semicolon after each, while a value's (Kept { id: 1, t: "a" }, send) take commas, and the language's own examples declared message { title: text, points: number } and to: { city: text, zip: u32 }, which did not compile. Now a comma, a newline or a semicolon ends a declared field too (one after the last as well); without one it says so.
Diffstat (limited to 'tests')
-rw-r--r--tests/check.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/check.py b/tests/check.py
index 211d508..4624eb6 100644
--- a/tests/check.py
+++ b/tests/check.py
@@ -81,6 +81,7 @@ DIAGNOSTICS = [
('state a = 1e400\n', '1:11', 'number must be finite'),
('view v = 1 +\n', '1:13', 'expected a number, state, or expression'),
('state a = 0\non frame {\n a = 1 a\n}\n', '3:9', 'expected newline or semicolon'),
+ ('state a = 0\ninput m = message { x: u32 y: number }\n', '2:28', 'expected a comma, newline or semicolon'),
('state a = 0\non frame {\n if a {\n a = 1\n } els {\n }\n}\n', '5:5', 'expected newline or semicolon'),
# Each fn doubles what it inlines: f14 is past Pure's 65,535 instructions.
('\n'.join(['fn f0(x) = x + 1'] + [f'fn f{i}(x) = f{i - 1}(f{i - 1}(x))' for i in range(1, 15)] + ['view v = f14(1)']) + '\n',
@@ -296,6 +297,12 @@ DIAGNOSTICS = [
]
ACCEPTED = [
+ # Declared fields apart by commas, as a value's are (a message's, a group's, a record's, one after the last too).
+ 'record P { x = 0, y = 0, name: text }\nstate ps: list of P by x\n'
+ 'input add = message { x: u32, y: number, name: text }\n'
+ 'input ship = message {\n to: { city: text, zip: u32 },\n note: text,\n}\n'
+ 'on add {\n ps.add(P { x: add.x, y: add.y, name: add.name })\n}\n'
+ 'on ship {\n ps.add(P { x: ship.to.zip, name: ship.to.city })\n}\n',
# distinct, and tests bounding a keyed list's key: a range walk (Pure reads only the items in bounds) and a range view.
'record Line {\n id = 0\n item = 0\n qty = 0\n done = 0\n}\nstate lines: list of Line by id\n'
'input deliver = message {\n order: u32\n}\non deliver {\n let start = deliver.order * 16\n'