Skip to content

Commit

Permalink
Test function output across each environment
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Jun 20, 2024
1 parent 1b67ebe commit 162d9b4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion test/packages/TestPackage/0.1.0/src/TestPackage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module TestPackage

import Example

greet() = Example.hello("0.1.0!")
greet() = print(Example.hello("0.1.0!"))

end # module TestPackage
2 changes: 1 addition & 1 deletion test/packages/TestPackage/0.2.0/src/TestPackage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module TestPackage

import Example

greet() = Example.hello("0.2.0!")
greet() = print(Example.hello("0.2.0!"))

end # module TestPackage
36 changes: 14 additions & 22 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,25 @@ end
"JULIA_DEPOT_PATH" => DEPOT_PATH[1],
),
)
output = readchomp(
addenv(
`julia +$each_version --startup-file=no --project=$project -e "import TestPackage; TestPackage.greet()"`,
"JULIA_DEPOT_PATH" => DEPOT_PATH[1],
),
)
version = last(split(basename(project), "@"))
@test contains(output, "Hello, $(version)!")
end
end

cd(@__DIR__) do
key = PackageBundler.keypair()
@test isfile(key.private)
@test isfile(key.public)
@testset "Package Bundling" begin
cd(@__DIR__) do
key = PackageBundler.keypair()
@test isfile(key.private)
@test isfile(key.public)

PackageBundler.bundle()
end

mktempdir() do script_dir
script = joinpath(script_dir, "script.jl")
open(script, "w") do io
println(io, "import Pkg")
println(io, "Pkg.activate(; temp = true)")
println(io, "Pkg.status()")
println(io, "Pkg.add(\"TestPackage\")")
println(io, "import TestPackage")
println(io, "println(TestPackage.greet())")
PackageBundler.bundle()
end
run(
addenv(
`julia --startup-file=no $script`,
"JULIA_DEPOT_PATH" => DEPOT_PATH[1],
),
)
end
end
end

0 comments on commit 162d9b4

Please sign in to comment.