Skip to content

Commit

Permalink
Stabilize sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
eagletmt committed Oct 19, 2015
1 parent d3b1403 commit a90dae3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
20 changes: 10 additions & 10 deletions incompatibilities/spec/render/attribute_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
## Input
```haml
- v = [1, nil, false, true]
%span{class: v}
%span{class: [1, nil, false, true]}
```

## Faml, Haml
Expand All @@ -77,8 +76,8 @@
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
## Input
```haml
- h = { class: [1, nil, false, true] }
%span{h}
- v = [1, nil, false, true]
%span{class: v}
```

## Faml, Haml
Expand All @@ -96,7 +95,8 @@
# [./spec/render/attribute_spec.rb:71](../../../spec/render/attribute_spec.rb#L71)
## Input
```haml
%span{class: [1, nil, false, true]}
- h = { class: [1, nil, false, true] }
%span{h}
```

## Faml, Haml
Expand Down Expand Up @@ -132,8 +132,7 @@
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
## Input
```haml
- v = [1, nil, false, true]
%span{id: v}
%span{id: [1, nil, false, true]}
```

## Faml, Haml
Expand All @@ -151,8 +150,8 @@
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
## Input
```haml
- h = { id: [1, nil, false, true] }
%span{h}
- v = [1, nil, false, true]
%span{id: v}
```

## Faml, Haml
Expand All @@ -170,7 +169,8 @@
# [./spec/render/attribute_spec.rb:85](../../../spec/render/attribute_spec.rb#L85)
## Input
```haml
%span{id: [1, nil, false, true]}
- h = { id: [1, nil, false, true] }
%span{h}
```

## Faml, Haml
Expand Down
5 changes: 3 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ module RenderSpecHelper
require_relative 'support/incompatibilities_generator'

def render_string(str, options = {})
loc = caller_locations(1..1)[0]
eval(Faml::Engine.new(options).call(str)).tap do |html|
IncompatibilitiesGenerator.instance.record(str, options, html, RSpec.current_example)
IncompatibilitiesGenerator.instance.record(str, options, html, RSpec.current_example, loc.lineno)
end
rescue => e
IncompatibilitiesGenerator.instance.record(str, options, e, RSpec.current_example)
IncompatibilitiesGenerator.instance.record(str, options, e, RSpec.current_example, loc.lineno)
raise e
end
else
Expand Down
6 changes: 3 additions & 3 deletions spec/support/incompatibilities_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class IncompatibilitiesGenerator
include Singleton

Record = Struct.new(:template, :options, :spec_path, :line_number, :faml_result, :haml_result, :hamlit_result) do
Record = Struct.new(:template, :options, :spec_path, :line_number, :caller_lineno, :faml_result, :haml_result, :hamlit_result) do
def incompatible?
!all_error? && (faml_result != haml_result || faml_result != hamlit_result || haml_result != hamlit_result)
end
Expand Down Expand Up @@ -39,9 +39,9 @@ def initialize
@records = []
end

def record(template, options, faml_result, example)
def record(template, options, faml_result, example, caller_lineno)
m = example.location.match(/\A(.+):(\d+)\z/)
@records.push(Record.new(template, options, m[1], m[2].to_i, faml_result, render_haml(template, options), render_hamlit(template, options)))
@records.push(Record.new(template, options, m[1], m[2].to_i, caller_lineno, faml_result, render_haml(template, options), render_hamlit(template, options)))
end

def write_to(markdown_root)
Expand Down

0 comments on commit a90dae3

Please sign in to comment.