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

Fixture injection #5

Closed
la10736 opened this issue Feb 3, 2019 · 3 comments
Closed

Fixture injection #5

la10736 opened this issue Feb 3, 2019 · 3 comments
Assignees
Milestone

Comments

@la10736
Copy link
Owner

la10736 commented Feb 3, 2019

Define a fixture procedural macro that define a fixture.

Input fixture can be simple functions or should be fixture functions. Fixture function will return Fixture wrapper that can be nested and control value life cycle.

We'll associate to fixture two static methods:

  • get(args) that return exactly what the original function returns
  • default() that return get()'s result by resolve all arguments as fixtures

Fixture will execute tear down at the end of the test and not when fixture value will be dropped.

We leave teardown implementation for next release and a new ticket. Maybe get and default will return a tuple instead a wrapper and Fixture will be a trait implemented on that tuples.

Note: We not use a wrapper for fixture return type to not go deep in the impl resolution hell. By now struct cannot wrap any function return type.

@la10736 la10736 self-assigned this Feb 3, 2019
@la10736 la10736 added this to the rstest 0.3 milestone Feb 3, 2019
la10736 pushed a commit that referenced this issue Apr 17, 2019
la10736 pushed a commit that referenced this issue Apr 18, 2019
@la10736 la10736 changed the title Fixture inception Fixture injection Apr 19, 2019
@la10736
Copy link
Owner Author

la10736 commented Apr 19, 2019

TODO

  • Test new() with some argumets
  • Fixture should maintains the original visibility
  • Fixture that take and return impl types
  • Fixture that take and return dyn types
  • Fixture that take and return generic object

la10736 pushed a commit that referenced this issue Apr 19, 2019
la10736 added a commit that referenced this issue Apr 20, 2019
la10736 added a commit that referenced this issue Apr 23, 2019
@la10736
Copy link
Owner Author

la10736 commented Apr 30, 2019

Fixture should not create a struct that wrap function return value to not fight with impl, dyn and generics. Should just give some static method to get

  • the fixture by given all inputs (just a tuple and a TearDownGuard?)
  • the default fixture that resolve all arguments by call sub fixture

la10736 pushed a commit that referenced this issue Apr 30, 2019
la10736 pushed a commit that referenced this issue Apr 30, 2019
la10736 pushed a commit that referenced this issue Apr 30, 2019
la10736 pushed a commit that referenced this issue May 3, 2019
la10736 added a commit that referenced this issue May 5, 2019
… not necessary mut. We maintain both body till #34 is implemented.
la10736 added a commit that referenced this issue May 5, 2019
@la10736
Copy link
Owner Author

la10736 commented Jun 28, 2019

Done

@la10736 la10736 closed this as completed Jun 28, 2019
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

1 participant