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

Allow creation of OutputCallbackInfo and InputCallbackInfo objects (for test purposes) #899

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danutsu
Copy link

@danutsu danutsu commented Jul 12, 2024

This change makes the fields of StreamInstant, OutputCallbackInfo and InputCallbackInfo pub.

The intent is to allow OutputCallbackInfo instances to be created, which then allows unit testing the data callback function. Because it is a self-contained function that simply fills data in a buffer, it is, in principle, very unit-testable -- but it's very difficult to do so today because the test code cannot create an OutputCallbackInfo for it.

I don't believe there's any good reason for these fields to not be pub. In particular, I noticed the fields of OutputStreamTimestamp are public, so the "middle" layer is already creatable, just not StreamInstant and OutputCallbackInfo. Also, the structures are pretty plain data objects with no special logic or anything like that, so there really is no harm in allowing them to be created.

danutsu added 3 commits July 12, 2024 20:51
This allows StreamInstants to be created, which enables testing the
data callback function with unit tests.
Looks like making the fields public means they
are now exposed in JS so they need wasm_bindgen

I added the attribute on the input side too: the
CI test only needs the output side but it only
makes sense to have it both ways.
@danutsu
Copy link
Author

danutsu commented Jul 12, 2024

Fixed the emscripten issue, please take a look and let me know if I need to do anything else.

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.

1 participant