test/compiler_selector: :gcc was renamed to :gcc_4_2
This commit is contained in:
parent
341eac2f62
commit
47fdc3dfc9
@ -4,13 +4,13 @@ require "software_spec"
|
||||
describe CompilerSelector do
|
||||
subject { described_class.new(software_spec, versions, compilers) }
|
||||
|
||||
let(:compilers) { [:clang, :gcc, :gnu] }
|
||||
let(:compilers) { [:clang, :gcc_4_2, :gnu] }
|
||||
let(:software_spec) { SoftwareSpec.new }
|
||||
let(:cc) { :clang }
|
||||
let(:versions) do
|
||||
double(
|
||||
gcc_4_0_build_version: Version::NULL,
|
||||
gcc_build_version: Version.create("5666"),
|
||||
gcc_4_2_build_version: Version.create("5666"),
|
||||
llvm_build_version: Version::NULL,
|
||||
clang_build_version: Version.create("425"),
|
||||
)
|
||||
@ -29,7 +29,7 @@ describe CompilerSelector do
|
||||
describe "#compiler" do
|
||||
it "raises an error if no matching compiler can be found" do
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
software_spec.fails_with(gcc: "4.8")
|
||||
software_spec.fails_with(gcc: "4.7")
|
||||
|
||||
@ -42,11 +42,11 @@ describe CompilerSelector do
|
||||
|
||||
it "returns gcc if it fails with clang" do
|
||||
software_spec.fails_with(:clang)
|
||||
expect(subject.compiler).to eq(:gcc)
|
||||
expect(subject.compiler).to eq(:gcc_4_2)
|
||||
end
|
||||
|
||||
it "returns clang if it fails with gcc" do
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
expect(subject.compiler).to eq(:clang)
|
||||
end
|
||||
|
||||
@ -57,41 +57,41 @@ describe CompilerSelector do
|
||||
|
||||
it "still returns gcc-4.8 if it fails with gcc without a specific version" do
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
expect(subject.compiler).to eq("gcc-4.8")
|
||||
end
|
||||
|
||||
it "returns gcc if it fails with clang and llvm" do
|
||||
software_spec.fails_with(:clang)
|
||||
expect(subject.compiler).to eq(:gcc)
|
||||
expect(subject.compiler).to eq(:gcc_4_2)
|
||||
end
|
||||
|
||||
it "returns clang if it fails with gcc and llvm" do
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
expect(subject.compiler).to eq(:clang)
|
||||
end
|
||||
|
||||
example "returns gcc if it fails with a specific gcc version" do
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(gcc: "4.8")
|
||||
expect(subject.compiler).to eq(:gcc)
|
||||
expect(subject.compiler).to eq(:gcc_4_2)
|
||||
end
|
||||
|
||||
example "returns a lower version of gcc if it fails with the highest version" do
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
software_spec.fails_with(gcc: "4.8")
|
||||
expect(subject.compiler).to eq("gcc-4.7")
|
||||
end
|
||||
|
||||
it "prefers gcc" do
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(:gcc)
|
||||
software_spec.fails_with(:gcc_4_2)
|
||||
expect(subject.compiler).to eq("gcc-4.8")
|
||||
end
|
||||
|
||||
it "raises an error when gcc is missing" do
|
||||
allow(versions).to receive(:gcc_build_version).and_return(Version::NULL)
|
||||
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
||||
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(gcc: "4.8")
|
||||
@ -101,7 +101,7 @@ describe CompilerSelector do
|
||||
end
|
||||
|
||||
it "raises an error when llvm and gcc are missing" do
|
||||
allow(versions).to receive(:gcc_build_version).and_return(Version::NULL)
|
||||
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
|
||||
|
||||
software_spec.fails_with(:clang)
|
||||
software_spec.fails_with(gcc: "4.8")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user