Sha256: 2d6ffa269f764432cbb2949e3b47e980c9a88cdc3f71869becf76a784b3f541d

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require 'ffi/clang'

include FFI::Clang

module ClangSpecHelper
	def fixture_path(path)
		File.join File.expand_path("../fixtures", __FILE__), path
	end

	def find_all(cursor, kind)
		ret = []

		cursor.visit_children do |cursor, parent|
			if (cursor.kind == kind)
				ret << cursor
			end
			:recurse
		end

		ret
	end

	def find_first(cursor, kind)
		find_all(cursor, kind).first
	end

	def find_all_matching(cursor, &term)
		ret = []

		cursor.visit_children do |child, parent|
			if term.call child, parent
				ret << child
			end

			:recurse
		end

		ret
	end

	def find_matching(cursor, &term)
		find_all_matching(cursor, &term).first
	end
end

RSpec.configure do |c|
	c.include ClangSpecHelper
	supported_versions = ['3.2', '3.3', '3.4', '3.5']
	current_version = ENV['LLVM_VERSION'] || supported_versions.last
	supported_versions.reverse_each { |version|
		break if version == current_version
		sym = ('from_' + version.tr('.', '_')).to_sym
		c.filter_run_excluding sym => true
	}

	supported_versions.each { |version|
		break if version == current_version
		sym = ('upto_' + version.tr('.', '_')).to_sym
		c.filter_run_excluding sym => true
	}
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-clang-0.2.0 spec/spec_helper.rb