|
2 gadi atpakaļ | |
---|---|---|
.. | ||
README.md | 2 gadi atpakaļ | |
cycle_test | 2 gadi atpakaļ | |
load_test | 3 gadi atpakaļ | |
spellcheck_test | 2 gadi atpakaļ |
Running tests will make sure that crew is working correctly or explain the problem if it's not.
The tests can be used at any time to help with development but make sure to run them before submitting a Pull Request.
To prepare a new test, create a ruby script. It may use crew constants (created in lib/const.rb
) and import packages (be sure to use require_relative
).
It should finish normally if the test passed, otherwise abort with exit 1
and preferably explain why the test failed.
A simple example of a test script called my_test
is below:
#!/usr/bin/env ruby
# Makes sure buildessential package depends on gcc
require_relative "../lib/package"
pkg = Package.load_package('../package/buildessential.rb')
if pkg.dependencies and pkg.dependencies.has_key?('gcc') then
puts "Everything works properly.".lightgreen
else
puts "Buildessential should depend on gcc!".lightred
exit 1
end
Make sure the script is executable with chmod +x my_test
. Note: This will only work in directories with execute permission.
Execute ruby my_test
from this directory (tests/
). If all tests pass, it should display a message similar to All tests successful.
, otherwise it should indicate what went wrong.
Running tests manually may not work!