Skip to content

Commit 2f376b0

Browse files
committed
Add additional expression-default tests
1 parent ba7bf24 commit 2f376b0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/model_def.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,28 @@ end
157157
@mlj_model mutable struct Foo1
158158
a::Vector{Int} = [1, 2, 3]
159159
end
160-
Foo1().a == [1, 2, 3]
160+
@test Foo1().a == [1, 2, 3]
161161
@mlj_model mutable struct Foo2
162162
a::Vector{Int} = [1, 2, 3]::(true)
163163
end
164-
Foo2().a == [1, 2, 3]
164+
@test Foo2().a == [1, 2, 3]
165165

166-
# Negative number:
166+
# Constraints applied
167167
@mlj_model mutable struct Foo3
168-
a::Float64 = -1.0
168+
a::Vector{Int} = [1, 2, 3]::(all(>(0), _))
169169
end
170-
Foo3().a === -1.0
170+
@test redirect_stderr(devnull) do
171+
Foo3(; a = [-1]).a == [1, 2, 3]
172+
end
173+
174+
# Negative number:
171175
@mlj_model mutable struct Foo4
176+
a::Float64 = -1.0
177+
end
178+
@test Foo4().a === -1.0
179+
@mlj_model mutable struct Foo5
172180
a::Float64 = (-1.0)::(true)
173181
end
174-
Foo4().a == -1.0
182+
@test Foo5().a == -1.0
175183

176184
end

0 commit comments

Comments
 (0)