Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read test via telnet-host #337

Merged
merged 3 commits into from
Jun 24, 2024
Merged

read test via telnet-host #337

merged 3 commits into from
Jun 24, 2024

Conversation

abesto
Copy link
Collaborator

@abesto abesto commented Jun 23, 2024

I accumulated a bunch of biggish changes while working on the suspend/read/notify tests. It'd be good to land them, with the as-yet-failing test disabled, to avoid a long-running branch with big changes.

Refactor

Before this PR, the execution model of moot is incompatible with flows involving read(). Changed things up to fix that; also added docs about the syntax of .moot files which has grown beyond trivial by now.

Extended .moot syntax: =exact output

"Normal" assertions in .moot files represent MOO values (i.e. Vars). In practice, this means we run the expected value through an extra eval to resolve them. This allows nice things like using player as expected output, and getting the comparison to work as we'd naively expect.

Notably, this is the only way we can even do assertions at all when running Scheduler-based tests, because from Scheduler we get a Var as the result of the eval call (and not some string-serialized response).

This flow becomes suuuper fragile in the presence of read(), because the order of messages is hard to reason about (and maybe not even guaranteed). So instead of trying to figure that out, let's introduce a way to say: do not do any kind of extra processing; take the expected value as a string, and compare it to our actual result as a string. This only works on network-based tests.

(I guess we could Be Smart, and do the extra resolve step when running with Scheduler and not do it when running via the network, but it feels like being explicit here is the less confusing approach)

Failing suspend() + read() test

Weirdly, the ; notify(player, "read: " + read()); return "retval"; case seems to be passing consistently now. Probably #338 made a bigger impact than I initially thought.

Starting this with suspend(0.1) makes it fail though; that test is currently commented out.

@abesto abesto changed the title repro: read() is ... wonky? slow? read test via telnet-host Jun 24, 2024
This makes failure messages marginally less useful, but it aligns `moot`
with how MOO *actually* works. This refactor makes it possible to
express more complex flows.
@abesto abesto marked this pull request as ready for review June 24, 2024 20:37
@rdaum rdaum merged commit 2a19f32 into rdaum:main Jun 24, 2024
5 checks passed
@abesto abesto deleted the moot/read branch June 24, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants