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

Should cancelFunc be public? #96

Open
LucasChenPandaTW opened this issue Mar 6, 2023 · 1 comment
Open

Should cancelFunc be public? #96

LucasChenPandaTW opened this issue Mar 6, 2023 · 1 comment

Comments

@LucasChenPandaTW
Copy link

LucasChenPandaTW commented Mar 6, 2023

From the v1.0.0 release, the cancelFunc is introduced during FSM init with context. However, we had decoupled the callback function. When the unit test of callback may panic since it may cause the cancelFunc is not assignable.
For example:
create a callback function and do the unit test with a callback function. The input event may not have cancelFunc and caused panic.

P.S: Here is the event caused the panic.

Suggestion:

  1. We may need to skip the cancelFunc if it is nil to give decouple when testing the callback function here.
  2. We may need to public the cancelFunc to CancelFunc or a set function to assign the cancelFunc.
@mikegleasonjr
Copy link

Having the same issue, should cancelFunc be always non-nil and be a no-op by default?

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

No branches or pull requests

2 participants