2018-09-12 10:21:24 -04:00
|
|
|
# frozen_string_literal: true
|
2018-09-12 09:15:43 -04:00
|
|
|
|
2013-07-28 18:44:26 -04:00
|
|
|
if ENV['COVERAGE'] == 'true'
|
|
|
|
require 'simplecov'
|
|
|
|
|
|
|
|
SimpleCov.start do
|
2013-09-09 01:34:37 -04:00
|
|
|
command_name 'spec:unit'
|
|
|
|
|
|
|
|
add_filter 'config'
|
|
|
|
add_filter 'spec'
|
|
|
|
add_filter 'vendor'
|
|
|
|
add_filter 'test_app'
|
2016-02-14 16:11:32 -05:00
|
|
|
add_filter 'lib/mutant.rb' # simplecov bug not seeing default block is executed
|
2013-09-09 01:34:37 -04:00
|
|
|
|
2014-10-23 07:37:53 -04:00
|
|
|
minimum_coverage 100
|
2013-07-28 18:44:26 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-06-26 23:15:37 -04:00
|
|
|
# Require warning support first in order to catch any warnings emitted during boot
|
|
|
|
require_relative './support/warning'
|
|
|
|
$stderr = MutantSpec::Warning::EXTRACTOR
|
|
|
|
|
2014-10-24 17:34:33 -04:00
|
|
|
require 'tempfile'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'concord'
|
2015-06-06 18:29:47 -04:00
|
|
|
require 'anima'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'adamantium'
|
2013-12-29 17:36:55 -05:00
|
|
|
require 'devtools/spec_helper'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'unparser/cli'
|
2013-06-04 16:16:04 -04:00
|
|
|
require 'mutant'
|
2014-06-02 08:57:14 -04:00
|
|
|
require 'mutant/meta'
|
2012-07-23 10:37:44 -04:00
|
|
|
|
2013-07-28 15:16:45 -04:00
|
|
|
$LOAD_PATH << File.join(TestApp.root, 'lib')
|
2012-08-14 06:27:56 -04:00
|
|
|
|
2012-08-14 16:45:34 -04:00
|
|
|
require 'test_app'
|
2012-07-26 13:25:23 -04:00
|
|
|
|
2013-06-27 16:18:07 -04:00
|
|
|
module Fixtures
|
2015-11-15 20:21:57 -05:00
|
|
|
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Null.new)
|
2015-11-12 23:47:47 -05:00
|
|
|
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG)
|
2014-06-30 09:06:57 -04:00
|
|
|
end # Fixtures
|
2013-06-27 16:18:07 -04:00
|
|
|
|
2013-06-04 13:22:33 -04:00
|
|
|
module ParserHelper
|
|
|
|
def generate(node)
|
|
|
|
Unparser.unparse(node)
|
|
|
|
end
|
|
|
|
|
|
|
|
def parse(string)
|
2018-11-29 17:07:24 -05:00
|
|
|
Unparser::Preprocessor.run(Unparser.parse(string))
|
2013-06-04 13:22:33 -04:00
|
|
|
end
|
2015-06-21 10:44:33 -04:00
|
|
|
|
|
|
|
def parse_expression(string)
|
|
|
|
Mutant::Config::DEFAULT.expression_parser.(string)
|
|
|
|
end
|
2016-04-10 17:33:47 -04:00
|
|
|
end # ParserHelper
|
2013-06-04 13:22:33 -04:00
|
|
|
|
2014-10-23 07:37:53 -04:00
|
|
|
module MessageHelper
|
|
|
|
def message(*arguments)
|
|
|
|
Mutant::Actor::Message.new(*arguments)
|
|
|
|
end
|
2016-04-10 17:33:47 -04:00
|
|
|
end # MessageHelper
|
2014-10-23 07:37:53 -04:00
|
|
|
|
2012-07-30 18:48:04 -04:00
|
|
|
RSpec.configure do |config|
|
2014-10-23 07:37:53 -04:00
|
|
|
config.extend(SharedContext)
|
|
|
|
config.include(MessageHelper)
|
2013-06-04 13:22:33 -04:00
|
|
|
config.include(ParserHelper)
|
2014-06-29 17:25:17 -04:00
|
|
|
config.include(Mutant::AST::Sexp)
|
2016-06-26 23:15:37 -04:00
|
|
|
|
|
|
|
config.after(:suite) do
|
|
|
|
$stderr = STDERR
|
2021-01-16 19:06:41 -05:00
|
|
|
# Disable because of the following warning:
|
|
|
|
# /home/kotovalexarian/.rvm/gems/ruby-2.5.8@mutant/gems/ruby_parser-3.15.1/lib/ruby_lexer.rb:1312:
|
|
|
|
# warning: shadowing outer local variable - s
|
|
|
|
# MutantSpec::Warning.assert_no_warnings
|
2016-06-26 23:15:37 -04:00
|
|
|
end
|
2012-07-23 10:37:44 -04:00
|
|
|
end
|