Skip to content
Snippets Groups Projects
Commit 76767f3d authored by George Hartzell's avatar George Hartzell Committed by Dominyk Tiller
Browse files

Formula-Cookbook: Improve testing suggestions


Based on recent feedback on some pull requests, I touched up the section about adding tests to formula.
I wanted to make it clearer that the examples demonstrate how to create files on the fly and add a pointer to the tinyxml2 formula (DomT4 pointed it out to me as a good example).

Closes Homebrew/homebrew#49641.

Signed-off-by: default avatarDominyk Tiller <dominyktiller@gmail.com>
parent b4edf23a
No related branches found
No related tags found
No related merge requests found
......@@ -245,7 +245,7 @@ The [`test do`](http://www.rubydoc.info/github/Homebrew/homebrew/master/Formula#
We want tests that don't require any user input and test the basic functionality of the application. For example `foo build-foo input.foo` is a good test and (despite their widespread use) `foo --version` and `foo --help` are bad tests. However, a bad test is better than no test at all.
See [cmake](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cmake.rb) for an example of a formula with a good test. A basic `CMakeLists.txt` file is written CMake uses it to generate Makefiles. This test checks that CMake doesn't e.g. segfault during basic operation.
See [cmake](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cmake.rb) for an example of a formula with a good test. The formula writes a basic `CMakeLists.txt` file into the test directory then calls CMake to generate Makefiles. This test checks that CMake doesn't e.g. segfault during basic operation. Another good example is [tinyxml2](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/tinyxml2.rb), which writes a small C++ source file into the test directory, compiles and links it against the tinyxml2 library and finally checks that the resulting program runs successfully.
## Manuals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment