Skip to content

Conversation

MashyBasker
Copy link
Contributor

@MashyBasker MashyBasker commented Aug 8, 2024

chore: add Rust example for unit test runner

Overview

This pull request adds a new Rust example to the examples/unittest directory. The purpose is to demonstrate how to generate and run unit tests for Rust code using the UnitTestGenerator from the kaizen.generator.unit_test module.

Changes

  • Key Changes:
    • Added a new file rust.py in the examples/unittest directory
    • Implemented a simple Calculator struct with add, subtract, and get_result methods
    • Implemented a greet function that takes a name and returns a greeting
    • Included the Rust code in the code variable and used the UnitTestGenerator to run the tests
  • New Features:
    • Provided an example of how to generate and run unit tests for Rust code using the UnitTestGenerator
  • Refactoring:
    • No major refactoring changes were made in this pull request

✨ Generated with love by Kaizen ❤️

Original Description Added an example in `examples/unittest` to generate and run tests for rust code. Contains the following constructs: - `module` - `functions` - `impl` block

Signed-off-by: Maharshi Basu <basumaharshi10@gmail.com>
Copy link
Contributor

kaizen-bot bot commented Aug 8, 2024

Code Review

Attention Required: This PR has potential issues. 🚨

Missing Function Parameter

The 'run_tests()' method is called without any parameters, but it likely needs the Rust code as input.

Potential Solution:

Pass the 'code' variable to the 'run_tests()' method.

examples/unittest/rust.py | 42 - 42

reason_for_request: Without passing the Rust code to the test generator, it won't be able to generate or run any tests.

level: [critical] , severity: [9]

✨ Generated with love by Kaizen ❤️


Useful Commands
  • Feedback: Reply with !feedback [your message]

  • Ask PR: Reply with !ask-pr [your question]

  • Review: Reply with !review

}
'''

test_results = generator.run_tests()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: The 'run_tests()' method is called without any parameters, but it likely needs the Rust code as input.

Solution: Pass the 'code' variable to the 'run_tests()' method.

Reason For Comment: Without passing the Rust code to the test generator, it won't be able to generate or run any tests.

Suggested change
test_results = generator.run_tests()
test_results = generator.run_tests(code)

@sauravpanda sauravpanda merged commit f59f8e6 into Cloud-Code-AI:main Aug 8, 2024
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