How can I verify that a print is called for in dart unit tests?
I am writing a sample code for textbooks and want to try it out. There are many examples that use printing for simplicity. I want to run my unit tests to make sure the print is called with the correct input but I have a problem importing the main function in another dart file.
Thank you!
You can import any library, including a script with a
main
method. The problem is that your own script'smain
method shadows the import.The solution is to import the library with a prefix: