From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Demo: Organizing test files

Demo: Organizing test files

- [Instructor] Within our project here, we haven't written actual tests and we've had several different things that we've added, like doc tests that we've been working with. Now, to write tests, you might be wondering what is the best strategy here? And Rust has a couple of different things here. We have a test directory with a test center score standard in .rs file. And in there we're going to be adding some tests for some other file. Now, this is a thing that you can do. You can structure your tests in this way. And actually, one thing that I like is to use tree to demonstrate the actual structure versus just using the explorer right here. So let me go ahead and do that. So if I open my terminal here and I do ls, you'll see that I have tests, I have source, target, and the read me file and other files. So if I do tree tests, you'll see that I only have a single file. So one thing that you can do is as you keep adding more files to your project, you will be adding them to the tests…

Contents