-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand type of a property with union and add tests on it
- Loading branch information
1 parent
da44d81
commit bd0b200
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import PlantGeomPrimitives as PGP | ||
using Test | ||
|
||
|
||
module dummy | ||
struct bar end | ||
|
||
struct foo end | ||
|
||
struct oomp end | ||
end | ||
|
||
let | ||
|
||
import .dummy as D | ||
|
||
r = PGP.Rectangle() | ||
e = PGP.Ellipse() | ||
t = PGP.Triangle() | ||
|
||
PGP.add_property!(r, :prop, D.bar()) | ||
eltype(PGP.properties(r)[:prop]) == D.bar | ||
PGP.add!(r, e, prop = D.foo()) | ||
eltype(PGP.properties(r)[:prop]) == Union{D.bar, D.foo} | ||
PGP.add!(r, t, prop = D.oomp()) | ||
eltype(PGP.properties(r)[:prop]) == Union{D.bar, D.foo, D.oomp} | ||
|
||
end |