forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterpreter.jl
32 lines (28 loc) · 919 Bytes
/
interpreter.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This file is a part of Julia. License is MIT: https://julialang.org/license
using Test
# interpreted but inferred/optimized top-level expressions with vars
let code = """
while true
try
this_is_undefined_29213
ed = 0
break
finally
break
end
end
print(42)
"""
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "42"
end
let code = "Threads.atomic_add!(Threads.Atomic{Int}(40), 2)"
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -E $code`, String) == "40\n"
end
let p = Pipe(),
c = pipeline(`$(Base.julia_cmd()) --startup-file=no --compile=min -E 'error()'`, stderr=p)
proc = run(c, wait=false)
readline(p)
@test readline(p) == "Stacktrace:"
wait(proc)
close(p)
end