Skip to content

Commit d3a2ba7

Browse files
authored
Merge pull request #158 from rdeits/julia-0.6
fix tests on julia v0.6-dev
2 parents 0b24136 + 4e5465c commit d3a2ba7

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/IJulia/setup.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ using Reactive
33
using Compat
44
import Compat.String
55

6-
import Base: writemime
76
import Interact: update_view, Slider, Widget, InputWidget, Latex, HTML, recv_msg,
87
statedict, viewdict, Layout, Box,
98
Progress, Checkbox, Button, ToggleButton, Textarea, Textbox, Options
109

11-
export mimewritable, writemime
10+
export mimewritable
1211

1312
const ijulia_js = readstring(joinpath(dirname(@__FILE__), "ijulia.js"))
1413

1514
if displayable("text/html")
16-
display("text/html", """
15+
display("text/html", Base.Docs.HTML("""
1716
<div id="interact-js-shim">
1817
<script charset="utf-8">$(ijulia_js)</script>
1918
<script>
@@ -25,7 +24,7 @@ if displayable("text/html")
2524
})
2625
\$([IPython.events]).on("kernel_starting.Kernel kernel_restarting.Kernel", function () { window.interactLoadedFlag = false })
2726
</script>
28-
</div>""")
27+
</div>"""))
2928
end
3029

3130
import IJulia
@@ -54,7 +53,7 @@ end
5453
function init_comm(x::Signal)
5554
if !haskey(comms, x)
5655
subscriptions = Dict{Compat.ASCIIString, Int}()
57-
function handle_subscriptions(msg)
56+
handle_subscriptions = (msg) -> begin
5857
if haskey(msg.content, "data")
5958
action = get(msg.content["data"], "action", "")
6059
if action == "subscribe_mime"
@@ -72,7 +71,7 @@ function init_comm(x::Signal)
7271
# Listen for mime type registrations
7372
comm.on_msg = handle_subscriptions
7473
# prevent resending the first time?
75-
function notify(value)
74+
notify = (value) -> begin
7675
mimes = keys(filter((k,v) -> v > 0, subscriptions))
7776
if length(mimes) > 0
7877
send_comm(comm, @compat Dict(:value =>

src/Interact.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Interact
44

55
using Reactive, Compat, DataStructures
66

7-
import Base: mimewritable, writemime
7+
import Base: mimewritable
88
export signal, Widget, InputWidget
99

1010
# A widget

test/ijulia.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ include(Interact.ijulia_setup_path)
1818
sliderWidget = slider(1:5)
1919
@testset "ijulia.jl" begin
2020

21-
@test """Interact.Slider{Int64}(Signal{Int64}(3, nactions=1),\"\",3,1:5,\"horizontal\",true,\"d\",true)""" == stringmime("text/plain", sliderWidget)
21+
removespaces(s) = replace(s, " ", "")
22+
# Julia v0.6 uses spaces after commas when printing types, but
23+
# previous versions did not. To ensure that this test works on all
24+
# versions, we just remove spaces from both sides of the comparison.
25+
@test removespaces("""Interact.Slider{Int64}(Signal{Int64}(3, nactions=1),\"\",3,1:5,\"horizontal\",true,\"d\",true)""") == removespaces(stringmime("text/plain", sliderWidget))
2226
@test "3" == stringmime("text/plain", signal(sliderWidget))
2327

2428
@test "" == stringmime("text/html", sliderWidget)

0 commit comments

Comments
 (0)