Tutorial by Examples

To run the unit tests for a package, use the Pkg.test function. For a package named MyPackage, the command would be julia> Pkg.test("MyPackage") An expected output would be similar to INFO: Computing test dependencies for MyPackage... INFO: Installing BaseTestNext v0.2.2 INFO: Te...
Unit tests are declared in the test/runtests.jl file in a package. Typically, this file begins using MyModule using Base.Test The basic unit of testing is the @test macro. This macro is like an assertion of sorts. Any boolean expression can be tested in the @test macro: @test 1 + 1 == 2 @test...
0.5.0 In version v0.5, test sets are built into the standard library Base.Test module, and you don't have to do anything special (besides using Base.Test) to use them. 0.4.0 Test sets are not part of Julia v0.4's Base.Test library. Instead, you have to REQUIRE the BaseTestNext module, and add u...
Exceptions encountered while running a test will fail the test, and if the test is not in a test set, terminate the test engine. Usually, this is a good thing, because in most situations exceptions are not the desired result. But sometimes, one wants to test specifically that a certain exception is ...
What's the deal with the following? julia> @test 0.1 + 0.2 == 0.3 Test Failed Expression: 0.1 + 0.2 == 0.3 Evaluated: 0.30000000000000004 == 0.3 ERROR: There was an error during testing in record(::Base.Test.FallbackTestSet, ::Base.Test.Fail) at ./test.jl:397 in do_test(::Base.Test....

Page 1 of 1