mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
docs: reference formula assertions for tests
This commit is contained in:
parent
ba62b988e1
commit
a1e2b8d75c
@ -261,7 +261,7 @@ We want tests that don't require any user input and test the basic functionality
|
|||||||
|
|
||||||
See [`cmake`](https://github.com/Homebrew/homebrew-core/blob/HEAD/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.
|
See [`cmake`](https://github.com/Homebrew/homebrew-core/blob/HEAD/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.
|
||||||
|
|
||||||
You can check that the output is as expected with `assert_equal` or `assert_match` on the output of shell_output such as in this example from the [envv formula](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/envv.rb):
|
You can check that the output is as expected with `assert_equal` or `assert_match` on the output of the [Formula assertions](https://rubydoc.brew.sh/Homebrew/Assertions.html) such as in this example from the [envv formula](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/envv.rb):
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
assert_equal "mylist=A:C; export mylist", shell_output("#{bin}/envv del mylist B").strip
|
assert_equal "mylist=A:C; export mylist", shell_output("#{bin}/envv del mylist B").strip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user