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: Using test failure messages - Rust Tutorial
From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development
Demo: Using test failure messages
- [Instructor] There are situations where you may want to add more context to the possible failures that your tests may have. So in this case where we're creating these tests, read standard in, and we had the new line, what we can do is we can extend that with the assert equals, and this will work for assert equals, both with that and assert not equals. So let's actually show you how you do, you can do that. So that's not equals. So that's, meaning line will not be equal to test. Now this will fail because these are equal. I'm going to run that and it fails, right? So if I go all the way to the top because I'm going to get a problem here with a panic, which is part of the failure. You can see here the left is not right because the assertion failed. So let's make it equal to so that we can make it a little bit more, so that it makes more sense. But let's assume that we're going to have, we're expecting to have a failure at some point, but if we have a failure, I want to provide more…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to testing1m 54s
-
(Locked)
Demo: Organizing test files3m 47s
-
(Locked)
Demo: Introduction to testing in Rust4m 24s
-
(Locked)
Demo: Writing tests for your code9m 16s
-
(Locked)
Demo: Testing private code11m 6s
-
(Locked)
Demo: Using test failure messages4m 10s
-
(Locked)
Summary of testing1m 24s
-
(Locked)
-