Skip to content

Commit 2d167fb

Browse files
committed
Only test stdout on >1.8
1 parent 019ff75 commit 2d167fb

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

test/test_print.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,21 @@ for binop in [safe_pow, ^]
4141
end
4242

4343
@testset "Test print_tree function" begin
44-
operators = OperatorEnum(; binary_operators=(+, *, /, -), unary_operators=(cos, sin))
45-
x1, x2, x3 = [Node(Float64; feature=i) for i in 1:3]
46-
tree = x1 * x1 + 0.5
47-
# Capture stdout to variable:
48-
pipe = Pipe()
49-
redirect_stdout(pipe) do
50-
print_tree(tree, operators)
44+
if VERSION > v"1.8"
45+
operators = OperatorEnum(;
46+
binary_operators=(+, *, /, -), unary_operators=(cos, sin)
47+
)
48+
x1, x2, x3 = [Node(Float64; feature=i) for i in 1:3]
49+
tree = x1 * x1 + 0.5
50+
# Capture stdout to variable:
51+
pipe = Pipe()
52+
redirect_stdout(pipe) do
53+
print_tree(tree, operators)
54+
end
55+
close(pipe.in)
56+
s = read(pipe.out, String)
57+
@test s == "((x1 * x1) + 0.5)\n"
5158
end
52-
close(pipe.in)
53-
s = read(pipe.out, String)
54-
@test s == "((x1 * x1) + 0.5)\n"
5559
end
5660

5761
@testset "Test printing of complex numbers" begin

0 commit comments

Comments
 (0)