Maximilian Downey Twiss de24923ee8 Add Rubocop CI (#7083) 2 gadi atpakaļ
..
README.md 7ed76d1845 crew: Isolate package classes from global scope (#7283) 2 gadi atpakaļ
cycle_test de24923ee8 Add Rubocop CI (#7083) 2 gadi atpakaļ
load_test 6403e4f04f Update tests (#5408) 3 gadi atpakaļ
spellcheck_test de24923ee8 Add Rubocop CI (#7083) 2 gadi atpakaļ

README.md

Tests

Why to run tests

Running tests will make sure that crew is working correctly or explain the problem if it's not.

When to run tests

The tests can be used at any time to help with development but make sure to run them before submitting a Pull Request.

Preparing new tests

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.

How to run tests

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!