require'pathname'# https://raw.githubusercontent.com/judofyr/minitest-line/master/MIT-LICENSE.txt# BEGIN generated by rake update, do not modify=begin
Copyright (c) 2014 Magnus Holm
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=end#END generated by rake update, do not modify# https://raw.githubusercontent.com/judofyr/minitest-line/master/lib/minitest/line_plugin.rb# BEGIN generated by rake update, do not modifymoduleMinitestmoduleLineclass<<selfdeftests_with_linestarget_file=$0methods_with_lines(target_file).concatdescribes_with_lines(target_file)endprivatedefmethods_with_lines(target_file)runnables.flat_mapdo|runnable|rname=runnable.namerunnable.runnable_methods.mapdo|name|file,line=runnable.instance_method(name).source_locationnextunlessfile==target_filetest_name=(rname?"#{rname}##{name}":name)[test_name,line]endend.uniq.compactenddefdescribes_with_lines(target_file)runnables.mapdo|runnable|nextunlesscaller=runnable.instance_variable_defined?(:@minitest_line_caller)&&runnable.instance_variable_get(:@minitest_line_caller)nextunlessline=caller.detect{|l|l.include?(target_file)}["/#{Regexp.escape(runnable.name)}/",line[/:(\d+):in/,1].to_i]end.compactenddefrunnablesMinitest::Runnable.runnablesendendenddefself.plugin_line_options(opts,options)opts.on'-l','--line N',Integer,"Run test at line number"do|lineno|options[:line]=linenoendenddefself.plugin_line_init(options)unlessexp_line=options[:line]reporter.reporters<<LineReporter.newreturnendtests=Minitest::Line.tests_with_linesfilter,_=tests.sort_by{|n,l|-l}.detect{|n,l|exp_line>=l}raise"Could not find test method before line #{exp_line}"unlessfilteroptions[:filter]=filterendclassLineReporter<Reporterdefinitialize(*)super@failures=[]enddefrecord(result)if!result.skipped?&&!result.passed?@failures<<resultendenddefreportreturnunless@failures.any?io.putsio.puts"Focus on failing tests:"pwd=Pathname.new(Dir.pwd)@failures.eachdo|res|result=(res.respond_to?(:source_location)?res:res.method(res.name))file,line=result.source_locationiffilefile=Pathname.new(file)file=file.relative_path_from(pwd)iffile.absolute?output="mtest #{file}:#{line}"output="\e[31m#{output}\e[0m"if$stdout.tty?io.putsoutputendendendenddefself.plugin_line_inject_reporterendend#END generated by rake update, do not modify# https://raw.githubusercontent.com/judofyr/minitest-line/master/lib/minitest/line/describe_track.rb# BEGIN generated by rake update, do not modifymoduleMinitestmoduleLinemoduleDescribeTrackdefdescribe(*args,&block)klass=superklass.instance_variable_set(:@minitest_line_caller,caller(0..5))klassendendendendObject.send(:include,Minitest::Line::DescribeTrack)#END generated by rake update, do not modify