[前][次][番号順一覧][スレッド一覧]

ruby-changes:63540

From: Kazuki <ko1@a...>
Date: Sat, 7 Nov 2020 22:13:07 +0900 (JST)
Subject: [ruby-changes:63540] 5823f6c25b (master): Fix indentation

https://git.ruby-lang.org/ruby.git/commit/?id=5823f6c25b

From 5823f6c25b4382cbc156bb990f9c3ce94ff257ed Mon Sep 17 00:00:00 2001
From: Kazuki Tsujimoto <kazuki@c...>
Date: Sat, 7 Nov 2020 22:12:22 +0900
Subject: Fix indentation


diff --git a/spec/ruby/language/pattern_matching_spec.rb b/spec/ruby/language/pattern_matching_spec.rb
index e34ff2d..1596b2b 100644
--- a/spec/ruby/language/pattern_matching_spec.rb
+++ b/spec/ruby/language/pattern_matching_spec.rb
@@ -23,10 +23,10 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L23
     it "extends case expression with case/in construction" do
       eval(<<~RUBY).should == :bar
         case [0, 1]
-          in [0]
-            :foo
-          in [0, 1]
-            :bar
+        in [0]
+          :foo
+        in [0, 1]
+          :bar
         end
       RUBY
     end
@@ -34,8 +34,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L34
     it "allows using then operator" do
       eval(<<~RUBY).should == :bar
         case [0, 1]
-          in [0]    then :foo
-          in [0, 1] then :bar
+        in [0]    then :foo
+        in [0, 1] then :bar
         end
       RUBY
     end
@@ -59,8 +59,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L59
     it "binds variables" do
       eval(<<~RUBY).should == 1
         case [0, 1]
-          in [0, a]
-            a
+        in [0, a]
+          a
         end
       RUBY
     end
@@ -69,8 +69,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L69
       -> {
         eval <<~RUBY
           case []
-            when 1 == 1
-            in []
+          when 1 == 1
+          in []
           end
         RUBY
       }.should raise_error(SyntaxError, /syntax error, unexpected `in'/)
@@ -78,8 +78,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L78
       -> {
         eval <<~RUBY
           case []
-            in []
-            when 1 == 1
+          in []
+          when 1 == 1
           end
         RUBY
       }.should raise_error(SyntaxError, /syntax error, unexpected `when'/)
@@ -88,12 +88,12 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L88
     it "checks patterns until the first matching" do
       eval(<<~RUBY).should == :bar
         case [0, 1]
-          in [0]
-            :foo
-          in [0, 1]
-            :bar
-          in [0, 1]
-            :baz
+        in [0]
+          :foo
+        in [0, 1]
+          :bar
+        in [0, 1]
+          :baz
         end
       RUBY
     end
@@ -101,10 +101,10 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L101
     it "executes else clause if no pattern matches" do
       eval(<<~RUBY).should == false
         case [0, 1]
-          in [0]
-            true
-          else
-            false
+        in [0]
+          true
+        else
+          false
         end
       RUBY
     end
@@ -113,7 +113,7 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L113
       -> {
         eval <<~RUBY
           case [0, 1]
-            in [0]
+          in [0]
           end
         RUBY
       }.should raise_error(NoMatchingPatternError, /\[0, 1\]/)
@@ -123,8 +123,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L123
       -> {
         eval <<~RUBY
           case 0
-            in 1 + 1
-              true
+          in 1 + 1
+            true
           end
         RUBY
       }.should raise_error(SyntaxError, /unexpected/)
@@ -134,8 +134,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L134
       it "supports if guard" do
         eval(<<~RUBY).should == false
           case 0
-            in 0 if false
-              true
+          in 0 if false
+            true
           else
             false
           end
@@ -143,8 +143,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L143
 
         eval(<<~RUBY).should == true
           case 0
-            in 0 if true
-              true
+          in 0 if true
+            true
           else
             false
           end
@@ -154,8 +154,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L154
       it "supports unless guard" do
         eval(<<~RUBY).should == false
           case 0
-            in 0 unless true
-              true
+          in 0 unless true
+            true
           else
             false
           end
@@ -163,8 +163,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L163
 
         eval(<<~RUBY).should == true
           case 0
-            in 0 unless false
-              true
+          in 0 unless false
+            true
           else
             false
           end
@@ -174,8 +174,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L174
       it "makes bound variables visible in guard" do
         eval(<<~RUBY).should == true
           case [0, 1]
-            in [a, 1] if a >= 0
-              true
+          in [a, 1] if a >= 0
+            true
           end
         RUBY
       end
@@ -183,7 +183,7 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L183
       it "does not evaluate guard if pattern does not match" do
         eval <<~RUBY
           case 0
-            in 1 if (ScratchPad << :foo) || true
+          in 1 if (ScratchPad << :foo) || true
           else
           end
         RUBY
@@ -194,10 +194,10 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L194
       it "takes guards into account when there are several matching patterns" do
         eval(<<~RUBY).should == :bar
           case 0
-            in 0 if false
-              :foo
-            in 0 if true
-              :bar
+          in 0 if false
+            :foo
+          in 0 if true
+            :bar
           end
         RUBY
       end
@@ -205,8 +205,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L205
       it "executes else clause if no guarded pattern matches" do
         eval(<<~RUBY).should == false
           case 0
-            in 0 if false
-              true
+          in 0 if false
+            true
           else
             false
           end
@@ -217,7 +217,7 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L217
         -> {
           eval <<~RUBY
             case [0, 1]
-              in [0, 1] if false
+            in [0, 1] if false
             end
           RUBY
         }.should raise_error(NoMatchingPatternError, /\[0, 1\]/)
@@ -228,36 +228,36 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L228
       it "matches an object such that pattern === object" do
         eval(<<~RUBY).should == true
           case 0
-            in 0
-              true
+          in 0
+            true
           end
         RUBY
 
         eval(<<~RUBY).should == true
           case 0
-            in (-1..1)
-              true
+          in (-1..1)
+            true
           end
         RUBY
 
         eval(<<~RUBY).should == true
           case 0
-            in Integer
-              true
+          in Integer
+            true
           end
         RUBY
 
         eval(<<~RUBY).should == true
           case "0"
-            in /0/
-              true
+          in /0/
+            true
           end
         RUBY
 
         eval(<<~RUBY).should == true
           case "0"
-            in ->(s) { s == "0" }
-              true
+          in ->(s) { s == "0" }
+            true
           end
         RUBY
       end
@@ -267,8 +267,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L267
 
         eval(<<~RUBY).should == true
           case "x"
-            in "#{x + ""}"
-              true
+          in "#{x + ""}"
+            true
           end
         RUBY
       end
@@ -278,8 +278,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L278
       it "matches a value and binds variable name to this value" do
         eval(<<~RUBY).should == 0
           case 0
-            in a
-              a
+          in a
+            a
           end
         RUBY
       end
@@ -287,7 +287,7 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L287
       it "makes bounded variable visible outside a case statement scope" do
         eval(<<~RUBY).should == 0
           case 0
-            in a
+          in a
           end
 
           a
@@ -297,9 +297,9 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L297
       it "create local variables even if a pattern doesn't match" do
         eval(<<~RUBY).should == [0, nil, nil]
           case 0
-            in a
-            in b
-            in c
+          in a
+          in b
+          in c
           end
 
           [a, b, c]
@@ -309,8 +309,8 @@ ruby_version_is "2.7" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/pattern_matching_spec.rb#L309
       it "allow using _ name to drop values" do
         eval(<<~RUBY).sho (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]