Skip to content

fix: Better test for exercises/10_modules/modules1.rs#2369

Closed
JiwaniZakir wants to merge 2 commits intorust-lang:mainfrom
JiwaniZakir:better-test-exercises-10_modules-2339
Closed

fix: Better test for exercises/10_modules/modules1.rs#2369
JiwaniZakir wants to merge 2 commits intorust-lang:mainfrom
JiwaniZakir:better-test-exercises-10_modules-2339

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Fixes #2339

The modules1 exercise could be passed by commenting out the call in main, since no test enforced that make_sausage() must be public. Adds a #[cfg(test)] block to exercises/10_modules/modules1.rs that calls sausage_factory::make_sausage() directly, and sets test = true in rustlings-macros/info.toml so rustlings actually runs cargo test against the exercise.

@JiwaniZakir
Copy link
Copy Markdown
Author

Closing this PR as it hasn't received maintainer review. Happy to resubmit if there's interest.

@senekor
Copy link
Copy Markdown
Contributor

senekor commented Apr 17, 2026

I'm not sure what this would improve. The new tests can also just be commented out. We don't need to prevent cheating, since we assume users do these exercises voluntarily.

We could possibly add a comment above the main function, telling users not to change it, in case it's unclear. But that seems pretty obvious to me from the context.

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.

Better test for exercises/10_modules/modules1.rs

2 participants