Skip to content

Commit a1fc807

Browse files
committed
test: add test of binary_operator direct parsing
1 parent 23b1bd3 commit a1fc807

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/test_parse.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,19 @@ let
330330
end
331331
end
332332

333-
# Misc tests
334-
let
333+
@testitem "Test parsing convenience functionality" begin
334+
using DynamicExpressions
335+
336+
ex = @parse_expression(
337+
x * x - cos(0.3 * y - 0.9),
338+
binary_operators = [+, *, -],
339+
unary_operators = [cos],
340+
variable_names = [:x, :y]
341+
)
342+
343+
s = sprint((io, e) -> show(io, MIME"text/plain"(), e), ex)
344+
@test s == "(x * x) - cos((0.3 * y) - 0.9)"
345+
end
335346
ex = parse_expression(
336347
:(x);
337348
operators=OperatorEnum(; binary_operators=[+, -, *, /]),

0 commit comments

Comments
 (0)