Good question!

In 0.4 the printing for @test has been improved quite significantly to 
display the values of variables.

julia> a,b = 1,2

julia> @test a==b 
ERROR: test failed: (1 == 2) 
in expression: a == b 
in error at error.jl:19 
in default_handler at test.jl:27 
in do_test at test.jl:50 

julia> @assert a==b
ERROR: AssertionError: a == b


There is some discussion in #10614 
<https://github.com/JuliaLang/julia/issues/10614> about means to disable 
assertions, so there is a conceptual difference in that assertions is used 
inside a program to test for invalid inputs to functions, but tests are 
usually runned externally to see that functions work correctly for 
different outputs.

Regards
Ivar

onsdag 25. mars 2015 18.26.30 UTC+1 skrev Ismael VC følgende:
>
> Hello guys!
>
> I just had someone ask me this question and I didn't know what to answer 
> him, example:
>
> julia> using Base.Test
>
> julia> @test 1 == 1
>
> julia> @test 1 == 3
> ERROR: test failed: 1 == 3
>  in error at error.jl:21 (repeats 2 times)
>
> julia> @assert 1 == 1
>
> julia> @assert 1 == 3
> ERROR: assertion failed: 1 == 3
>  in error at error.jl:21 (repeats 2 times)
>
> I fail to see the difference, besides that `@test` conveys the idea of 
> "testing". 
>
> Even the error message is even the same:  `in error at error.jl:21 
> (repeats 2 times)`
>
> Thanks!
>

Reply via email to