Skip to content

Commit

Permalink
slight improvements to the tests for global function and `local fun…
Browse files Browse the repository at this point in the history
…ction`
  • Loading branch information
JeffBezanson committed Apr 14, 2016
1 parent 0b39902 commit 28cc70a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,24 +414,24 @@ test_parseerror("if false\nelseif\nend", "missing condition in \"elseif\" at non
@test expand(parse("foo(y = (global x)) = y")) == Expr(:error, "misplaced \"global\" declaration")

# issue #15844
function glob_fn(x)
function f15844(x)
x
end

function add_method_to_glob_fn!()
global function glob_fn(x::Int)
-x
g15844 = let
local function f15844(x::Int32)
2x
end
end

function add_method_to_local_fn!()
local function glob_fn(x::Int)
-x
function add_method_to_glob_fn!()
global function f15844(x::Int64)
3x
end
end

@test glob_fn(1) == 1
@test add_method_to_local_fn!() glob_fn
@test glob_fn(1) == 1
@test add_method_to_glob_fn!() == glob_fn
@test glob_fn(1) == -1
add_method_to_glob_fn!()
@test g15844 !== f15844
@test g15844(Int32(1)) == 2
@test f15844(Int32(1)) == 1
@test f15844(Int64(1)) == 3

0 comments on commit 28cc70a

Please sign in to comment.