Revision 2d803f30ef2ca9eb143da9b32a6243d31e85aa18 authored by Martin Holters on 27 April 2017, 04:03:47 UTC, committed by Jeff Bezanson on 27 April 2017, 04:03:47 UTC
* Only evaluate `fexpr` in `fexpr(kw=...)` once

Lower e.g. `get_inner()(kw=1)` to
```
SSAValue(n) = get_inner()
((Core.kwfunc)(SSAValue(n)))((Base.vector_any)(:kw, 1), SSAValue(n))
```
instead of
```
((Core.kwfunc)(get_inner()))((Base.vector_any)(:kw, 1), get_inner())
```
as the latter would call `get_inner` twice.

Fixes #21518.
1 parent 67fdcf2
Raw File
libgit2-online.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license

#########
# TESTS #
#########
# init & clone
mktempdir() do dir
    repo_url = "https://github.com/JuliaLang/Example.jl"
    @testset "Cloning repository" begin
        @testset "with 'https' protocol" begin
            repo_path = joinpath(dir, "Example1")
            repo = LibGit2.clone(repo_url, repo_path)
            try
                @test isdir(repo_path)
                @test isdir(joinpath(repo_path, ".git"))
            finally
                close(repo)
            end
        end

        @testset "with incorrect url" begin
            try
                repo_path = joinpath(dir, "Example2")
                # credentials are required because github tries to authenticate on unknown repo
                cred = LibGit2.UserPasswordCredentials("","") # empty credentials cause authentication error
                LibGit2.clone(repo_url*randstring(10), repo_path, payload=Nullable(cred))
                error("unexpected")
            catch ex
                @test isa(ex, LibGit2.Error.GitError)
                @test ex.code == LibGit2.Error.EAUTH
            end
        end
    end
end
back to top