Skip to content

Commit

Permalink
Merge pull request #1375 from sass/no-version
Browse files Browse the repository at this point in the history
Drop support for multiple language versions
  • Loading branch information
nex3 authored Apr 11, 2019
2 parents 499ca9a + cddcb0b commit b1fdef8
Show file tree
Hide file tree
Showing 200 changed files with 1,375 additions and 16,075 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ env:
matrix:
fast_finish: true
include:
- env: LANGUAGE_VERSION=4.0 IMPL=libsass COMMAND="../sassc/bin/sassc"
- env: LANGUAGE_VERSION=4.0 IMPL=dart-sass
- env: IMPL=libsass COMMAND="../sassc/bin/sassc"
- env: IMPL=dart-sass

before_install:
- if ./tools/skipped-for-impl.sh; then exit 0; fi
Expand All @@ -41,7 +41,7 @@ before_install:

script:
- if [ $IMPL == "dart-sass" ]; then
bundle exec sass-spec.rb -V $LANGUAGE_VERSION --dart ../dart-sass;
bundle exec sass-spec.rb --dart ../dart-sass;
else
bundle exec sass-spec.rb -V $LANGUAGE_VERSION --impl $IMPL -c $COMMAND;
bundle exec sass-spec.rb --impl $IMPL -c $COMMAND;
fi
8 changes: 0 additions & 8 deletions lib/sass_spec/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ def self.parse
options[:verbose] = true
end

opts.on("-V", "--version LANGUAGE_VERSION", "Select the Sass Language Version to test.") do |v|
unless SassSpec::LANGUAGE_VERSIONS.include?(v)
raise ArgumentError.new("Version #{v} is not valid. " +
"Did you mean one of: #{SassSpec::LANGUAGE_VERSIONS.join(', ')}")
end
options[:language_version] = v
end

opts.on("-t", "--tap", "Output TAP compatible report") do
options[:tap] = true
end
Expand Down
30 changes: 10 additions & 20 deletions lib/sass_spec/engine_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ def describe
not_implemented
end

# The version string of the implementation
def version
not_implemented
end

def to_s
describe
end

# Compile a Sass file and return the results
# @return [css_output, std_error, status_code]
def compile(sass_filename, precision)
Expand All @@ -36,6 +27,7 @@ def initialize(command, description = nil)
@command = command
@timeout = 90
@description = description || command
@version = `#{@command} -v`
end

def set_description(description)
Expand All @@ -46,13 +38,6 @@ def describe
@description
end

def version
require 'open3'
stdout, stderr, status = Open3.capture3("#{@command} -v", :binmode => true)
stdout.to_s
end


def compile(sass_filename, precision)
command = File.absolute_path(@command)
dirname, basename = File.split(sass_filename)
Expand All @@ -66,6 +51,10 @@ def compile(sass_filename, precision)
[result[:stdout], result[:stderr], result[:status].exitstatus]
end
end

def to_s
"#{@description} #{@version}"
end
end

class DartEngineAdapter < EngineAdapter
Expand Down Expand Up @@ -108,23 +97,24 @@ def initialize(path)
@stdout.set_encoding 'binary'
@stderr.set_encoding 'binary'
end
@version = `dart #{@path}/bin/sass.dart --version`
end

def describe
"dart-sass"
end

def version
`dart #{@path}/bin/sass.dart --version`
end

def compile(sass_filename, precision)
dirname, basename = File.split(sass_filename)
@stdin.puts "!cd #{File.absolute_path(dirname)}"
@stdin.puts "--no-color --no-unicode #{@args} #{basename}"
[next_chunk(@stdout), next_chunk(@stderr), next_chunk(@stdout).to_i]
end

def to_s
"Dart Sass #{@version}"
end

private

def next_chunk(io)
Expand Down
25 changes: 1 addition & 24 deletions lib/sass_spec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class SassSpec::Runner

def initialize(options = {})
@options = options
@options[:language_version] = language_version.to_s
end

def get_input_dirs
Expand Down Expand Up @@ -37,8 +36,7 @@ def get_input_files

def run
unless @options[:silent] || @options[:tap]
puts "Recursively searching under #{get_input_dirs.join(", ")} for test files to test '#{@options[:engine_adapter]}' against language version #{@options[:language_version]}."
puts @options[:engine_adapter].version
puts "Recursively searching under #{get_input_dirs.join(", ")} for test files to test #{@options[:engine_adapter]}."
end

test_cases = _get_cases
Expand Down Expand Up @@ -74,21 +72,6 @@ def run
result
end

def language_version
unless defined?(@language_version)
@language_version = if @options[:language_version]
Gem::Version.new(@options[:language_version])
elsif @options[:engine_adapter].respond_to?(:language_version)
Gem::Version.new(@options[:engine_adapter].language_version)
else
warn "No language version specified. " +
"Using #{SassSpec::MAX_LANGUAGE_VERSION}"
SassSpec::MAX_LANGUAGE_VERSION
end
end
@language_version
end

def impl
@options[:engine_adapter].describe
end
Expand All @@ -98,12 +81,6 @@ def _get_cases
get_input_files().each do |filename|
dir = SassSpec::Directory.new(File.dirname(filename))
metadata = SassSpec::TestCaseMetadata.new(dir)
unless metadata.valid_for_version?(language_version)
if @options[:verbose]
warn "#{metadata.name} does not apply to Sass #{language_version}"
end
next
end

unless metadata.valid_for_impl?(impl)
if @options[:verbose]
Expand Down
25 changes: 0 additions & 25 deletions lib/sass_spec/test_case_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,8 @@ def precision
@options[:precision]
end

def start_version
@start_version ||= Gem::Version.new(@options[:start_version] || SassSpec::MIN_LANGUAGE_VERSION)
end

def end_version
unless defined?(@end_version)
@end_version = if @options[:end_version]
Gem::Version.new(@options[:end_version])
else
nil
end
end
@end_version
end

def valid_for_version?(version)
version = Gem::Version.new(version) if version.is_a?(String)
valid = start_version <= version
if end_version
valid &&= version <= end_version
end
valid
end

def valid_for_impl?(impl)
!ignore_for?(impl)
end

end
end
152 changes: 0 additions & 152 deletions spec/basic/16_hex_arithmetic.hrx

This file was deleted.

24 changes: 0 additions & 24 deletions spec/basic/23_basic_value_interpolation-4.0.hrx

This file was deleted.

Loading

0 comments on commit b1fdef8

Please sign in to comment.