Skip to content

Commit

Permalink
Merge pull request #1308 from sass/refactor
Browse files Browse the repository at this point in the history
Refactor some spec infrastructure
  • Loading branch information
nex3 authored Nov 29, 2018
2 parents 7a3da2e + a33a3df commit 2447f06
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 239 deletions.
17 changes: 0 additions & 17 deletions lib/sass_spec/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ def self.parse
options[:only_output_styles] << style
end

opts.on("-r SPEC_DIR", "--root SPEC_DIR", "Root directory for the specs. ",
"Defaults to the first directory specified if not provided or ",
"the default spec directory if no directory is specified or if the first directory",
"specified is a subdirectory of the default spec directory.") do |spec_dir|
options[:spec_directory] = File.expand_path(spec_dir)
end

opts.on("--migrate-version", "Copy tests that fail and make them pass for the current version.") do
options[:migrate_version] = true
end
Expand All @@ -131,16 +124,6 @@ def self.parse
end
end.parse!

if ARGV.any? && !options[:spec_directory]
if File.expand_path(ARGV[0]).start_with?(SassSpec::SPEC_DIR)
options[:spec_directory] = SassSpec::SPEC_DIR
else
options[:spec_directory] = File.expand_path(ARGV[0])
end
end

options[:spec_directory] ||= SassSpec::SPEC_DIR

options[:spec_dirs_to_run] = ARGV.dup.map{|d| File.expand_path(d)} if ARGV.any?

if options[:implementation] && options[:engine_adapter].respond_to?(:set_description)
Expand Down
23 changes: 3 additions & 20 deletions lib/sass_spec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(options = {})
end

def get_input_dirs
(@options[:spec_dirs_to_run] || Array(@options[:spec_directory])).map do |d|
(@options[:spec_dirs_to_run] || [SassSpec::SPEC_DIR]).map do |d|
d = File.expand_path(d)
File.directory?(d) ? d : File.dirname(d)
end
Expand Down Expand Up @@ -42,24 +42,7 @@ def run
Minitest.reporter = Minitap::TapY
end

result = Minitest.run(minioptions)

if @options[:run_todo]
passing = []
test_cases.each do |test_case|
if test_case.todo? && test_case.result?
passing << test_case.folder
end
end
if passing.any?
puts "The following tests pass but were marked as TODO for #{@options[:engine_adapter].describe}:"
puts passing.join("\n")
else
puts "Note: All tests marked as TODO for #{@options[:engine_adapter].describe} are still failing."
end
end

result
Minitest.run(minioptions)
end

def language_version
Expand Down Expand Up @@ -106,7 +89,7 @@ def _get_cases
next unless @options[:only_output_styles].include?(metadata.output_style)
end

test_case = SassSpec::TestCase.new(folder, @options)
test_case = SassSpec::TestCase.new(folder, @options[:engine_adapter].describe)

# unless File.exist?(test_case.expected_path)
# if @options[:verbose]
Expand Down
Loading

0 comments on commit 2447f06

Please sign in to comment.