Skip to content

Commit

Permalink
test: ensure we can dispatch on StructuredExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jul 21, 2024
1 parent 17d0def commit 4f00623
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/test_structured_expression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ end
f = parse_expression(:(x * x - cos(2.5f0 * y + -0.5f0)); kws...)
g = parse_expression(:(exp(-(y * y))); kws...)

ex = StructuredExpression((; f, g), my_factory)
c = [1]
ex = StructuredExpression((; f, g), my_factory; a=c)

@test ex.metadata.extra.a[] == 1
@test ex.metadata.extra.a === c

# Should copy everything down to the metadata:
@test copy(ex).metadata.extra.a !== c

h(_) = 1
h(::StructuredExpression{<:Any,typeof(my_factory)}) = 2
Expand Down

0 comments on commit 4f00623

Please sign in to comment.