1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Sort specs

This commit is contained in:
Takashi Kokubun 2015-06-07 23:04:53 +09:00
parent 1191340cd1
commit 2eff6cca9c
5 changed files with 74 additions and 123 deletions

View file

@ -7,5 +7,4 @@ Showing incompatibilities against [Haml](https://github.com/haml/haml) and [Faml
- [engine/old\_attributes\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/old_attributes.md) - [engine/old\_attributes\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/old_attributes.md)
- [engine/script\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/script.md) - [engine/script\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/script.md)
- [engine/tag\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/tag.md)
- [engine/text\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/text.md) - [engine/text\_spec.rb](https://github.com/k0kubun/hamlit/blob/master/doc/engine/text.md)

View file

@ -1,29 +0,0 @@
# [tag\_spec.rb:228](https://github.com/k0kubun/hamlit/blob/master/spec/hamlit/engine/tag_spec.rb#L228)
## Input
```haml
%span!#{'<nyaa>'}
%span! #{'<nyaa>'}
!#{'<nyaa>'}
! #{'<nyaa>'}
```
## Output
### Haml
```html
<span><nyaa></span>
<span><nyaa></span>
!&lt;nyaa&gt;
<nyaa>
```
### Faml, Hamlit
```html
<span><nyaa></span>
<span><nyaa></span>
<nyaa>
<nyaa>
```

View file

@ -33,40 +33,37 @@ Haml::SyntaxError: Illegal element: classes and ids must have values.
``` ```
# [text\_spec.rb:74](https://github.com/k0kubun/hamlit/blob/master/spec/hamlit/engine/text_spec.rb#L74) # [text\_spec.rb:113](https://github.com/k0kubun/hamlit/blob/master/spec/hamlit/engine/text_spec.rb#L113)
## Input ## Input
```haml ```haml
aaa#{'<a>'} %span!#{'<nyaa>'}
!aaa#{'<a>'} %span! #{'<nyaa>'}
! aaa#{'<a>'} !#{'<nyaa>'}
! aaa#{'<a>'} ! #{'<nyaa>'}
!!aa
``` ```
## Output ## Output
### Haml ### Haml
```html ```html
aaa&lt;a&gt; <span><nyaa></span>
!aaa&lt;a&gt; <span><nyaa></span>
aaa<a> !&lt;nyaa&gt;
aaa<a> <nyaa>
!!aa
``` ```
### Faml, Hamlit ### Faml, Hamlit
```html ```html
aaa&lt;a&gt; <span><nyaa></span>
aaa<a> <span><nyaa></span>
aaa<a> <nyaa>
aaa<a> <nyaa>
!aa
``` ```
# [text\_spec.rb:93](https://github.com/k0kubun/hamlit/blob/master/spec/hamlit/engine/text_spec.rb#L93) # [text\_spec.rb:139](https://github.com/k0kubun/hamlit/blob/master/spec/hamlit/engine/text_spec.rb#L139)
## Input ## Input
```haml ```haml
1#{2 1#{2

View file

@ -186,68 +186,6 @@ describe Hamlit::Engine do
HTML HTML
end end
describe 'inline operator' do
it 'does not accept backslash operator' do
assert_render(<<-'HAML', <<-'HTML')
%span\ foo
HAML
<span>\ foo</span>
HTML
end
it 'accepts != operator' do
assert_render(<<-'HAML', <<-'HTML')
%span!= '<nyaa>'
HAML
<span><nyaa></span>
HTML
end
it 'accepts !== operator' do
assert_render(<<-'HAML', <<-'HTML')
%span!==#{'<nyaa>'}
%span!== #{'<nyaa>'}
!==#{'<nyaa>'}
!== #{'<nyaa>'}
HAML
<span><nyaa></span>
<span><nyaa></span>
<nyaa>
<nyaa>
HTML
end
it 'accepts &= operator' do
assert_render(<<-'HAML', <<-'HTML', escape_html: false)
%span&= '<nyaa>'
HAML
<span>&lt;nyaa&gt;</span>
HTML
end
it 'accepts ! operator' do
assert_render(<<-'HAML', <<-'HTML', compatible_only: :faml)
%span!#{'<nyaa>'}
%span! #{'<nyaa>'}
!#{'<nyaa>'}
! #{'<nyaa>'}
HAML
<span><nyaa></span>
<span><nyaa></span>
<nyaa>
<nyaa>
HTML
end
it 'accepts ~ operator' do
assert_render(<<-HAML, <<-HTML, escape_html: false)
%span~ 1
HAML
<span>1</span>
HTML
end
end
describe 'whitespace removal' do describe 'whitespace removal' do
it 'removes outer whitespace by >' do it 'removes outer whitespace by >' do
assert_render(<<-HAML, <<-HTML) assert_render(<<-HAML, <<-HTML)

View file

@ -71,22 +71,68 @@ describe Hamlit::Engine do
expect(render_string('\ a')).to eq(" a\n") expect(render_string('\ a')).to eq(" a\n")
end end
it 'renders ! operator' do describe 'inline operator' do
assert_render(<<-'HAML', <<-HTML, compatible_only: :faml) it 'does not accept backslash operator' do
aaa#{'<a>'} assert_render(<<-'HAML', <<-'HTML')
!aaa#{'<a>'} %span\ foo
! aaa#{'<a>'}
! aaa#{'<a>'}
!!aa
HAML HAML
aaa&lt;a&gt; <span>\ foo</span>
aaa<a>
aaa<a>
aaa<a>
!aa
HTML HTML
end end
it 'accepts != operator' do
assert_render(<<-'HAML', <<-'HTML')
%span!= '<nyaa>'
HAML
<span><nyaa></span>
HTML
end
it 'accepts !== operator' do
assert_render(<<-'HAML', <<-'HTML')
%span!==#{'<nyaa>'}
%span!== #{'<nyaa>'}
!==#{'<nyaa>'}
!== #{'<nyaa>'}
HAML
<span><nyaa></span>
<span><nyaa></span>
<nyaa>
<nyaa>
HTML
end
it 'accepts &= operator' do
assert_render(<<-'HAML', <<-'HTML', escape_html: false)
%span&= '<nyaa>'
HAML
<span>&lt;nyaa&gt;</span>
HTML
end
it 'accepts ! operator' do
assert_render(<<-'HAML', <<-'HTML', compatible_only: :faml)
%span!#{'<nyaa>'}
%span! #{'<nyaa>'}
!#{'<nyaa>'}
! #{'<nyaa>'}
HAML
<span><nyaa></span>
<span><nyaa></span>
<nyaa>
<nyaa>
HTML
end
it 'accepts ~ operator' do
assert_render(<<-HAML, <<-HTML, escape_html: false)
%span~ 1
HAML
<span>1</span>
HTML
end
end
describe 'string interpolation' do describe 'string interpolation' do
specify { assert_render('#{}', "\n") } specify { assert_render('#{}', "\n") }
specify { assert_render('1#{}', "1\n") } specify { assert_render('1#{}', "1\n") }