diff options
| author | eunhhu <[email protected]> | 2026-09-30 05:59:09 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-30 05:59:09 +0100 |
| commit | aa279fb959024134416fc33f90f648d8332e9af4 (patch) | |
| tree | b8640d24f0700d82798fac2c9378c281c0b4cdda /tests | |
| parent | e5716bd108039982d55bcd3b2da25e9f28b5825a (diff) | |
| download | aup-aa279fb959024134416fc33f90f648d8332e9af4.tar.gz aup-aa279fb959024134416fc33f90f648d8332e9af4.zip | |
Write a message once for its output and the input that takes it
Growing a board two nodes share (Pure's research 105), one field took
five places, two of them the same list: the output a node sends its
changes on and the input it takes the other's with. A message may now
take the fields of a message input or output declared before, in their
order: input remote = message like changed.
The module is the same as with the fields written out, byte for byte
(checked). An unknown name, one that is no message, the message itself,
and an output taking an input's rows are diagnosed.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/check.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/check.py b/tests/check.py index 06e029b..6408b05 100644 --- a/tests/check.py +++ b/tests/check.py @@ -244,6 +244,11 @@ DIAGNOSTICS = [ (ROWS + 'on o {\n for a in o.rows {\n reply "x"\n }\n}\n', '12:5', 'a message replies once: reply after the for'), ('record L {\n item = 0\n}\noutput o = message {\n rows: list of L\n}\n', '5:9', 'an output sends no rows: send one message a row'), + ('input a = message like nothing\n', '1:24', "'nothing' is no message input or output declared before"), + ('input k = key Space\ninput a = message like k\n', '2:24', "'k' is no message input or output declared before"), + ('input a = message like a\n', '1:24', "'a' is no message input or output declared before"), + ('record L {\n item = 0\n}\ninput i = message {\n rows: list of L\n}\noutput o = message like i\n', '7:25', + "an output sends no rows: 'i' has rows (rows)"), (ROWS + 'view v = o.rows.count\n', '10:10', "the rows of 'o' are only available in its handler"), (ROWS + 'on o {\n n = o.rows\n}\n', '11:7', "'o.rows' holds a message's rows: walk them (for r in o.rows) or read .count, .first or .last"), @@ -1279,6 +1284,19 @@ def main(): report['diagnostics'] = len(DIAGNOSTICS) report['accepted_forms'] = len(ACCEPTED) + # message like X is X's fields, written once: the same module, byte for byte. + fields = ' title: text\n lane: u32\n to: {\n city: text\n }\n' + body = 'on remote {\n n = remote.lane\n}\non tap.down {\n send changed { title: "t", lane: 1, to: { city: "c" } }\n}\n' + written = (f'state n = 0\ninput tap = key Space\noutput changed = message {{\n{fields}}}\n' + f'input remote = message {{\n{fields}}}\n{body}') + liked = (f'state n = 0\ninput tap = key Space\noutput changed = message {{\n{fields}}}\n' + f'input remote = message like changed\n{body}') + (work / 'written.aup').write_text(written) + (work / 'liked.aup').write_text(liked) + assert compile_module(aup, work / 'written.aup', work / 'written.pmod') == \ + compile_module(aup, work / 'liked.aup', work / 'liked.pmod'), 'message like differs from its fields written' + report['message_like'] = True + # Replacing a running module keeps states by name. compile_module(aup, ROOT / 'examples/counter.aup', work / 'counter.pmod') (work / 'counter2.aup').write_text('state bonus = 7\nstate count = 100\ninput tap = key Space\n' |
