From e50ad5fb9546452a2dda5c0f497a50ef563b7d8c Mon Sep 17 00:00:00 2001 From: ignisf Date: Sun, 15 Jun 2014 15:16:35 +0300 Subject: [PATCH] Add more version string specific tests --- ext/libv8/compiler.rb | 6 +----- spec/compiler/clang_spec.rb | 10 ---------- spec/compiler_spec.rb | 6 ++++++ spec/support/compiler_helpers.rb | 3 +-- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index a1f6df4..55fc7c2 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -15,10 +15,6 @@ module Libv8 module_function - def system_compilers - available_compilers(*Compiler::KNOWN_COMPILERS) - end - def available_compilers(*compiler_names) available = compiler_names.select { |compiler_name| available? compiler_name } available.map { |compiler_name| type_of(compiler_name).new compiler_name } @@ -26,7 +22,7 @@ module Libv8 def type_of(compiler_name) case version_string_of(compiler_name) - when /\bApple LLVM\b/ then AppleLLVM + when /^Apple LLVM\b/ then AppleLLVM when /\bclang\b/i then Clang when /^gcc/i then GCC else GenericCompiler diff --git a/spec/compiler/clang_spec.rb b/spec/compiler/clang_spec.rb index 78aca83..47e8918 100644 --- a/spec/compiler/clang_spec.rb +++ b/spec/compiler/clang_spec.rb @@ -23,16 +23,6 @@ module Libv8::Compiler it 'returns true' do stub_as_available 'c++', :clang, '3.4.1' subject.compatible?.should be_true - - stub_as_available 'c++', :clang, '3.10.0' - subject.compatible?.should be_true - end - end - - context 'when clang\'s version is < 3.1' do - it 'returns false' do - stub_as_available 'c++', :clang, '3.0.0' - subject.compatible?.should be_false end end end diff --git a/spec/compiler_spec.rb b/spec/compiler_spec.rb index bb09bda..aca3991 100644 --- a/spec/compiler_spec.rb +++ b/spec/compiler_spec.rb @@ -7,11 +7,17 @@ module Libv8 it 'recognises correctly GCC' do stub_as_available 'c++', :gcc, '4.9.0' Compiler.available_compilers('c++').first.should be_a Compiler::GCC + + stub_as_available 'g++', :gcc, '4.2.1-freebsd' + Compiler.available_compilers('g++').first.should be_a Compiler::GCC end it 'recognises correctly Clang' do stub_as_available 'c++', :clang, '3.4.1' Compiler.available_compilers('c++').first.should be_a Compiler::Clang + + stub_as_available 'freebsd-clang++', :clang, '3.3-freebsd' + Compiler.available_compilers('freebsd-clang++').first.should be_a Compiler::Clang end it 'recognises correctly Apple\'s LLVM' do diff --git a/spec/support/compiler_helpers.rb b/spec/support/compiler_helpers.rb index 58bc66a..93af6cc 100644 --- a/spec/support/compiler_helpers.rb +++ b/spec/support/compiler_helpers.rb @@ -5,9 +5,8 @@ module CompilerHelpers "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n} }, :clang => { + "3.3-freebsd" => %Q{FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610\nTarget: i386-unknown-freebsd9.2\nThread model: posix}, "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n}, - "3.10.0" => %Q{clang version 3.10.0 (tags/RELEASE_310/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n}, - "3.0.0" => %Q{clang version 3.0.0 (tags/RELEASE_30/dot0-final)\nTarget: x86_64-unknown-linux-gnu\n} }, :apple_llvm => { '5.1' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n}