We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 258aa74 commit 9d75e4cCopy full SHA for 9d75e4c
test/misc.jl
@@ -101,6 +101,32 @@ let deepthought(x, y) = 42
101
end
102
103
104
+# test @precondition
105
+let
106
+ f1(n) = begin @precondition n > 0; n end
107
+ f2(n) = begin @precondition n != 0 "non-zero n"; n end
108
+
109
+ @test f1(1) == 1
110
+ @test f2(1) == 1
111
112
+ try
113
+ f1(0)
114
+ error("unexpected")
115
+ catch ex
116
+ @test isa(ex, ArgumentError)
117
+ @test ismatch(r"f1(.*) requires n > 0", ex.msg)
118
+ end
119
120
121
+ f2(0)
122
123
124
125
+ @test ismatch(r"f2(.*) requires non-zero n", ex.msg)
126
127
+end
128
129
130
let # test the process title functions, issue #9957
131
oldtitle = Sys.get_process_title()
132
Sys.set_process_title("julia0x1")
0 commit comments