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

ruby-changes:35762

From: hsbt <ko1@a...>
Date: Wed, 8 Oct 2014 16:37:04 +0900 (JST)
Subject: [ruby-changes:35762] hsbt:r47844 (trunk): * test/ruby/test_syntax.rb: added syntax tests of underscore arguments.

hsbt	2014-10-08 16:36:52 +0900 (Wed, 08 Oct 2014)

  New Revision: 47844

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47844

  Log:
    * test/ruby/test_syntax.rb: added syntax tests of underscore arguments.
      [Feature #10340][ruby-core:65496]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_syntax.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47843)
+++ ChangeLog	(revision 47844)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct  8 16:36:47 2014    <>
+
+	* test/ruby/test_syntax.rb: added syntax tests of underscore arguments.
+	  [Feature #10340][ruby-core:65496]
+
 Wed Oct  8 07:42:39 2014  NARUSE, Yui  <naruse@r...>
 
 	* lib/uri/generic.rb (URI#inspect): remove Object id.
Index: test/ruby/test_syntax.rb
===================================================================
--- test/ruby/test_syntax.rb	(revision 47843)
+++ test/ruby/test_syntax.rb	(revision 47844)
@@ -204,18 +204,22 @@ WARN https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L204
 
   def test_duplicated_arg
     assert_syntax_error("def foo(a, a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_, _) end }
   end
 
   def test_duplicated_rest
     assert_syntax_error("def foo(a, *a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_, *_) end }
   end
 
   def test_duplicated_opt
     assert_syntax_error("def foo(a, a=1) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_, _=1) end }
   end
 
   def test_duplicated_opt_rest
     assert_syntax_error("def foo(a=1, *a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_=1, *_) end }
   end
 
   def test_duplicated_rest_opt
@@ -228,30 +232,37 @@ WARN https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L232
 
   def test_duplicated_opt_post
     assert_syntax_error("def foo(a=1, a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_=1, _) end }
   end
 
   def test_duplicated_kw
     assert_syntax_error("def foo(a, a: 1) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_, _: 1) end }
   end
 
   def test_duplicated_rest_kw
     assert_syntax_error("def foo(*a, a: 1) end", /duplicated argument name/)
+    assert_nothing_raised {def foo(*_, _: 1) end}
   end
 
   def test_duplicated_opt_kw
     assert_syntax_error("def foo(a=1, a: 1) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_=1, _: 1) end }
   end
 
   def test_duplicated_kw_kwrest
     assert_syntax_error("def foo(a: 1, **a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_: 1, **_) end }
   end
 
   def test_duplicated_rest_kwrest
     assert_syntax_error("def foo(*a, **a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(*_, **_) end }
   end
 
   def test_duplicated_opt_kwrest
     assert_syntax_error("def foo(a=1, **a) end", /duplicated argument name/)
+    assert_nothing_raised { def foo(_=1, **_) end }
   end
 
   def test_duplicated_when

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

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