You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 18, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/src/index.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,13 @@ If the condition is true, a `Pass` is returned:
42
42
```jldoctest testfoo
43
43
julia> @test foo("bar") == 9
44
44
Test Passed
45
+
Expression: foo("bar") == 9
46
+
Evaluated: 9 == 9
45
47
46
48
julia> @test foo("fizz") >= 10
47
49
Test Passed
50
+
Expression: foo("fizz") >= 10
51
+
Evaluated: 16 >= 10
48
52
```
49
53
50
54
If the condition is false, then a `Fail` is returned and an exception is thrown:
@@ -83,6 +87,7 @@ to check that this occurs:
83
87
```jldoctest testfoo
84
88
julia> @test_throws MethodError foo(:cat)
85
89
Test Passed
90
+
Expression: foo(:cat)
86
91
Thrown: MethodError
87
92
```
88
93
@@ -194,6 +199,8 @@ checks using either `@test a ≈ b` (where `≈`, typed via tab completion of `\
194
199
```jldoctest
195
200
julia> @test 1 ≈ 0.999999999
196
201
Test Passed
202
+
Expression: 1 ≈ 0.999999999
203
+
Evaluated: 1 ≈ 0.999999999
197
204
198
205
julia> @test 1 ≈ 0.999999
199
206
Test Failed at none:1
@@ -206,6 +213,8 @@ after the `≈` comparison:
206
213
```jldoctest
207
214
julia> @test 1 ≈ 0.999999 rtol=1e-5
208
215
Test Passed
216
+
Expression: ≈(1, 0.999999, rtol = 1.0e-5)
217
+
Evaluated: ≈(1, 0.999999; rtol = 1.0e-5)
209
218
```
210
219
Note that this is not a specific feature of the `≈` but rather a general feature of the `@test` macro: `@test a <op> b key=val` is transformed by the macro into `@test op(a, b, key=val)`. It is, however, particularly useful for `≈` tests.
0 commit comments