pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

Testing the import of a non-existing image #500

Closed mabdi closed 3 years ago

mabdi commented 3 years ago

I submit this pull request to suggest a new test method PhLImportImageCommandTest >> #testCanNotImportAnImage.

This method verifies a corner case in which an attempt to import a non-existing file is made. As you can see (line 43) a file which doesn’t exist is imported. And the assertion statement at line 44 verifies that a FileDoesNotExistException is indeed thrown. This is not immediately obvious as the method #PhLDirectoryBasedImageRepository::importImageNamed:andSiblingFilesto: just returns self if the imagefile does not exist.

Note that these suggestions are adapted from a test amplification tool called SmallAmp (https://github.com/mabdi/small-amp). SmallAmp executes existing tests, sees which parts of the class under test are not covered and then suggests improvements on the test methods.

I hope you will accept this pull request. It would illustrate that SmallAmp makes relevant suggestions.

Mehrdad Abdi.

demarey commented 3 years ago

Thank you for the PR. Indeed, the test you are adding has a value. Good job SmallAmp ;)