refactoring testball case to make it more readable
This commit is contained in:
parent
fa4e2bad6e
commit
f4d93e19b8
@ -135,11 +135,17 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
|||||||
case name
|
case name
|
||||||
when /^testball/
|
when /^testball/
|
||||||
case name
|
case name
|
||||||
when "testball4", "testball5", "testball2"
|
when "testball4", "testball5"
|
||||||
prefix = name
|
prefix = name
|
||||||
|
program_name = name
|
||||||
|
when "testball2"
|
||||||
|
prefix = name
|
||||||
|
program_name = "test"
|
||||||
else
|
else
|
||||||
prefix = "testball"
|
prefix = "testball"
|
||||||
|
program_name = "test"
|
||||||
end
|
end
|
||||||
|
|
||||||
tarball_name = "#{prefix}-0.1#{'-linux' if OS.linux?}.tbz"
|
tarball_name = "#{prefix}-0.1#{'-linux' if OS.linux?}.tbz"
|
||||||
tarball = TEST_FIXTURE_DIR / "tarballs/#{tarball_name}"
|
tarball = TEST_FIXTURE_DIR / "tarballs/#{tarball_name}"
|
||||||
|
|
||||||
@ -151,14 +157,13 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
|||||||
|
|
||||||
option "with-foo", "Build with foo"
|
option "with-foo", "Build with foo"
|
||||||
#{bottle_block}
|
#{bottle_block}
|
||||||
|
|
||||||
def install
|
def install
|
||||||
(prefix/"foo"/"#{prefix}").write("#{prefix}") if build.with? "foo"
|
(prefix/"foo"/"#{program_name}").write("#{program_name}") if build.with? "foo"
|
||||||
prefix.install Dir["*"]
|
prefix.install Dir["*"]
|
||||||
(buildpath/"#{prefix}.c").write \\
|
(buildpath/"#{program_name}.c").write \
|
||||||
"#include <stdio.h>\\nint main(){printf(\\"#{prefix}\\");return 0;}"
|
"#include <stdio.h>\\nint main(){printf(\\"#{program_name}\\");return 0;}"
|
||||||
bin.mkpath
|
bin.mkpath
|
||||||
system ENV.cc, "#{prefix}.c", "-o", bin/"#{prefix}"
|
system ENV.cc, "#{program_name}.c", "-o", bin/"#{program_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
#{content}
|
#{content}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user