Skip to content

Commit

Permalink
Merge pull request ruby-formatter#11 from ruby-formatter/dma/new-tests
Browse files Browse the repository at this point in the history
format(Tests): introduce new test format
  • Loading branch information
Daniel Ma authored Aug 8, 2017
2 parents b9d3c6e + 541e1d9 commit 2e56fd8
Show file tree
Hide file tree
Showing 108 changed files with 8,593 additions and 1,084 deletions.
1,139 changes: 55 additions & 1,084 deletions spec/rufo_spec.rb

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions spec/source_specs/2.3/lonely.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#~# ORIGINAL

foo &. bar

#~# EXPECTED

foo &. bar
7 changes: 7 additions & 0 deletions spec/source_specs/2.3/lonely_operator.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#~# ORIGINAL

foo&. bar

#~# EXPECTED

foo&. bar
7 changes: 7 additions & 0 deletions spec/source_specs/2.3/lonely_property_setters.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#~# ORIGINAL

foo&. bar = 1

#~# EXPECTED

foo&. bar = 1
9 changes: 9 additions & 0 deletions spec/source_specs/2.3/lonely_receiver_and_block.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#~# ORIGINAL

foo&.bar 1 do
end

#~# EXPECTED

foo&.bar 1 do
end
123 changes: 123 additions & 0 deletions spec/source_specs/2.3/squiggly_heredoc.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#~# ORIGINAL

[
[<<~'},'] # comment
},
]

#~# EXPECTED

[
[<<~'},'], # comment
},
]

#~# ORIGINAL

[
[<<~'},'], # comment
},
]

#~# EXPECTED

[
[<<~'},'], # comment
},
]

#~# ORIGINAL

[
[<<~'},'], # comment
},
2,
]

#~# EXPECTED

[
[<<~'},'], # comment
},
2,
]

#~# ORIGINAL

[
[<<~EOF] # comment
EOF
]

#~# EXPECTED

[
[<<~EOF], # comment
EOF
]

#~# ORIGINAL

begin
foo = <<~STR
some
thing
STR
end

#~# EXPECTED

begin
foo = <<~STR
some
thing
STR
end

#~# ORIGINAL

<<~EOF
foo
bar
EOF

#~# EXPECTED

<<~EOF
foo
bar
EOF

#~# ORIGINAL

<<~EOF
#{1}
bar
EOF

#~# EXPECTED

<<~EOF
#{1}
bar
EOF

#~# ORIGINAL

begin
<<~EOF
foo
bar
EOF
end

#~# EXPECTED

begin
<<~EOF
foo
bar
EOF
end
21 changes: 21 additions & 0 deletions spec/source_specs/BEGIN.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#~# ORIGINAL

BEGIN {
1
2
}

#~# EXPECTED

BEGIN {
1
2
}

#~# ORIGINAL

BEGIN { 1 ; 2 }

#~# EXPECTED

BEGIN { 1; 2 }
21 changes: 21 additions & 0 deletions spec/source_specs/END.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#~# ORIGINAL

END {
1
2
}

#~# EXPECTED

END {
1
2
}

#~# ORIGINAL

END { 1 ; 2 }

#~# EXPECTED

END { 1; 2 }
19 changes: 19 additions & 0 deletions spec/source_specs/__END__.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#~# ORIGINAL

1

__END__
this
is
still
here

#~# EXPECTED

1

__END__
this
is
still
here
31 changes: 31 additions & 0 deletions spec/source_specs/alias.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#~# ORIGINAL

alias foo bar

#~# EXPECTED

alias foo bar

#~# ORIGINAL

alias :foo :bar

#~# EXPECTED

alias :foo :bar

#~# ORIGINAL

alias store []=

#~# EXPECTED

alias store []=

#~# ORIGINAL

alias $foo $bar

#~# EXPECTED

alias $foo $bar
97 changes: 97 additions & 0 deletions spec/source_specs/align_assignments.rb.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#~# ORIGINAL
#~# align_assignments: true

x = 1
xyz = 2

w = 3

#~# EXPECTED

x = 1
xyz = 2

w = 3

#~# ORIGINAL
#~# align_assignments: true

x = 1
foo[bar] = 2

w = 3

#~# EXPECTED

x = 1
foo[bar] = 2

w = 3

#~# ORIGINAL
#~# align_assignments: true

x = 1; x = 2
xyz = 2

w = 3

#~# EXPECTED

x = 1; x = 2
xyz = 2

w = 3

#~# ORIGINAL
#~# align_assignments: true

a = begin
b = 1
abc = 2
end

#~# EXPECTED

a = begin
b = 1
abc = 2
end

#~# ORIGINAL
#~# align_assignments: true

a = 1
a += 2

#~# EXPECTED

a = 1
a += 2

#~# ORIGINAL
#~# align_assignments: true

foo = 1
a += 2

#~# EXPECTED

foo = 1
a += 2

#~# ORIGINAL
#~# align_assignments: false

x = 1
xyz = 2

w = 3

#~# EXPECTED

x = 1
xyz = 2

w = 3

Loading

0 comments on commit 2e56fd8

Please sign in to comment.