Skip to content

Commit

Permalink
Merge pull request sass#503 from saper/sass
Browse files Browse the repository at this point in the history
Support tests with indented syntax
  • Loading branch information
xzyfer committed Sep 21, 2015
2 parents 1640608 + 0261d96 commit faf86f0
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/sass_spec/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.parse

# Constants
output_styles: ["nested", "compressed", "expanded", "compact"],
input_file: 'input.scss',
input_files: ["input.scss", "input.sass"],
nested_output_file: 'expected_output',
compressed_output_file: 'expected.compressed',
expanded_output_file: 'expected.expanded',
Expand Down
24 changes: 13 additions & 11 deletions lib/sass_spec/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ def run

def _get_cases
cases = []
glob = File.join(@options[:spec_directory], "**", "#{@options[:input_file]}")
Dir.glob(glob) do |filename|
input = Pathname.new(filename)
@options[:output_styles].each do |output_style|
folder = File.dirname(filename)
output_file_name = @options["#{output_style}_output_file".to_sym]
expected_file_path = File.join(folder, output_file_name + ".css")
clean_file_name = File.join(folder, output_file_name + ".clean")
if File.file?(expected_file_path) && !File.file?(expected_file_path.sub(/\.css$/, ".skip")) && filename.include?(@options[:filter])
clean = File.file?(clean_file_name)
cases.push SassSpec::TestCase.new(input.realpath(), expected_file_path, output_style, clean, @options)
@options[:input_files].each do |input_file|
glob = File.join(@options[:spec_directory], "**", input_file)
Dir.glob(glob) do |filename|
input = Pathname.new(filename)
@options[:output_styles].each do |output_style|
folder = File.dirname(filename)
output_file_name = @options["#{output_style}_output_file".to_sym]
expected_file_path = File.join(folder, output_file_name + ".css")
clean_file_name = File.join(folder, output_file_name + ".clean")
if File.file?(expected_file_path) && !File.file?(expected_file_path.sub(/\.css$/, ".skip")) && filename.include?(@options[:filter])
clean = File.file?(clean_file_name)
cases.push SassSpec::TestCase.new(input.realpath(), expected_file_path, output_style, clean, @options)
end
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/sass/basic/input.scss

This file was deleted.

2 changes: 2 additions & 0 deletions spec/sass/imported/expected.compact.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
div a { color: red; }
div li { color: green; }
1 change: 1 addition & 0 deletions spec/sass/imported/expected.compressed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
div a{color:red}div li{color:green}
6 changes: 6 additions & 0 deletions spec/sass/imported/expected.expanded.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
div a {
color: red;
}
div li {
color: green;
}
4 changes: 4 additions & 0 deletions spec/sass/imported/expected_output.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
div a {
color: red; }
div li {
color: green; }
5 changes: 5 additions & 0 deletions spec/sass/imported/imported.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
div
a
color: red
li
color: green
1 change: 1 addition & 0 deletions spec/sass/imported/input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "imported.sass";

0 comments on commit faf86f0

Please sign in to comment.