Skip to content

Commit

Permalink
Actually test something
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Feb 17, 2023
1 parent 33e51ab commit f6856e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ end
# (<https://github.com/JuliaVersionControl/Git.jl/issues/40>) works correctly. While we run
# into that issue only on macOS, it's good to test it everywhere.
@testset "SIP workaround" begin
gitd(dir, cmd) = run(`$(git()) -C $(dir) -c "user.name=a" -c "user.email=b@c" $(cmd)`)
gitd(dir, cmd; stdout=Base.stdout, stderr=Base.stderr) =
run(pipeline(`$(git()) -C $(dir) -c "user.name=a" -c "user.email=b@c" $(cmd)`;
stdout, stderr))
branch = "dev"
mktempdir() do dir1; mktempdir() do dir2;
gitd(dir1, `init --bare --quiet --initial-branch $(branch)`)
Expand All @@ -60,5 +62,12 @@ end
gitd(dir2, `commit --quiet -m test`)
gitd(dir2, `remote add origin file://$(dir1)`)
gitd(dir2, `push --quiet --set-upstream origin $(branch)`)
dir1_io, dir2_io = IOBuffer(), IOBuffer()
gitd(dir1, `log`; stdout=dir1_io)
gitd(dir2, `log`; stdout=dir2_io)
# Make sure the logs are the same for the two repositories
dir1_log, dir2_log = String.(take!.((dir1_io, dir2_io)))
@test !isempty(dir1_log) === !isempty(dir2_log) === true
@test dir1_log == dir2_log
end; end
end

0 comments on commit f6856e4

Please sign in to comment.