diff --git a/spec/lib/rufo/formatter_source_specs/3.0/method_definition.rb.spec b/spec/lib/rufo/formatter_source_specs/3.0/method_definition.rb.spec deleted file mode 100644 index e3b751ea..00000000 --- a/spec/lib/rufo/formatter_source_specs/3.0/method_definition.rb.spec +++ /dev/null @@ -1,9 +0,0 @@ -#~# ORIGINAL partial_forward_args -def foo(a, ...) - p(...) -end - -#~# EXPECTED -def foo(a, ...) - p(...) -end diff --git a/spec/lib/rufo/formatter_source_specs/3.0/pattern_matching.rb.spec b/spec/lib/rufo/formatter_source_specs/3.0/pattern_matching.rb.spec deleted file mode 100644 index 59d05190..00000000 --- a/spec/lib/rufo/formatter_source_specs/3.0/pattern_matching.rb.spec +++ /dev/null @@ -1,72 +0,0 @@ -#~# ORIGINAL standalone (rightward assignment like syntax) - -[0,1,2] => [a,*b] - -#~# EXPECTED -[0, 1, 2] => [a, *b] - -#~# ORIGINAL find pattern - -case [0] -in [*x, - 0 => y ,*z] - 1 - end - -#~# EXPECTED -case [0] -in [*x, 0 => y, *z] - 1 -end - -#~# ORIGINAL find pattern unnamed rest args - -case [0] -in [*,0,*] - 1 - end - -#~# EXPECTED -case [0] -in [*, 0, *] - 1 -end - -#~# ORIGINAL find pattern multiple sub patterns - -case [0,1,3] -in [*,0,1,Integer=>y,*a] - y+(a[0] || 1 ) -end - -#~# EXPECTED -case [0, 1, 3] -in [*, 0, 1, Integer => y, *a] - y + (a[0] || 1) -end - -#~# ORIGINAL find constant pattern with parens - -case p - in Point(*, 1,*a) - a -end - -#~# EXPECTED -case p -in Point(*, 1, *a) - a -end - -#~# ORIGINAL find constant pattern with brackets - -case p - in Point[ * , 1 , *a ] - a -end - -#~# EXPECTED -case p -in Point[*, 1, *a] - a -end diff --git a/spec/lib/rufo/formatter_source_specs/3.0/endless_methods.rb.spec b/spec/lib/rufo/formatter_source_specs/endless_methods.rb.spec similarity index 100% rename from spec/lib/rufo/formatter_source_specs/3.0/endless_methods.rb.spec rename to spec/lib/rufo/formatter_source_specs/endless_methods.rb.spec diff --git a/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec b/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec index 3589621c..bdf487f8 100644 --- a/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec +++ b/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec @@ -361,3 +361,23 @@ end def foo(...) p(...) end + +#~# ORIGINAL partial_forward_args +def foo(a, ...) + p(...) +end + +#~# EXPECTED +def foo(a, ...) + p(...) +end + +#~# ORIGINAL issue_331 +def foo a: + a +end + +#~# EXPECTED +def foo(a:) + a +end diff --git a/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec b/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec index c497d363..48e4416c 100644 --- a/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec +++ b/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec @@ -65,3 +65,18 @@ def a x;x end;def b y;y end;def c z;z end # comment def a(x); x end def b(y); y end def c(z); z end # comment + +#~# ORIGINAL issue_331 +#~# parens_in_def: :dynamic +class User + def self.by_uid uid: + joins(:authentications).where(authentications: { uid: }).first + end +end + +#~# EXPECTED +class User + def self.by_uid uid: + joins(:authentications).where(authentications: { uid: }).first + end +end diff --git a/spec/lib/rufo/formatter_source_specs/pattern_matching.rb.spec b/spec/lib/rufo/formatter_source_specs/pattern_matching.rb.spec index b2ded974..bd3f86bb 100644 --- a/spec/lib/rufo/formatter_source_specs/pattern_matching.rb.spec +++ b/spec/lib/rufo/formatter_source_specs/pattern_matching.rb.spec @@ -938,3 +938,76 @@ case x in Foo(*) 1 end + +#~# ORIGINAL standalone (rightward assignment like syntax) + +[0,1,2] => [a,*b] + +#~# EXPECTED +[0, 1, 2] => [a, *b] + +#~# ORIGINAL find pattern + +case [0] +in [*x, + 0 => y ,*z] + 1 + end + +#~# EXPECTED +case [0] +in [*x, 0 => y, *z] + 1 +end + +#~# ORIGINAL find pattern unnamed rest args + +case [0] +in [*,0,*] + 1 + end + +#~# EXPECTED +case [0] +in [*, 0, *] + 1 +end + +#~# ORIGINAL find pattern multiple sub patterns + +case [0,1,3] +in [*,0,1,Integer=>y,*a] + y+(a[0] || 1 ) +end + +#~# EXPECTED +case [0, 1, 3] +in [*, 0, 1, Integer => y, *a] + y + (a[0] || 1) +end + +#~# ORIGINAL find constant pattern with parens + +case p + in Point(*, 1,*a) + a +end + +#~# EXPECTED +case p +in Point(*, 1, *a) + a +end + +#~# ORIGINAL find constant pattern with brackets + +case p + in Point[ * , 1 , *a ] + a +end + +#~# EXPECTED +case p +in Point[*, 1, *a] + a +end