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

ruby-changes:25735

From: knu <ko1@a...>
Date: Thu, 22 Nov 2012 14:06:08 +0900 (JST)
Subject: [ruby-changes:25735] knu:r37792 (trunk): Add some corner cases to tests for String#index.

knu	2012-11-22 14:02:30 +0900 (Thu, 22 Nov 2012)

  New Revision: 37792

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

  Log:
    Add some corner cases to tests for String#index.
    
    * test/ruby/test_string.rb (TestString#test_index): Add some
      corner cases to tests for String#index, which might fail if ruby
      directly used a buggy memmem(3) implementation.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_string.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37791)
+++ ChangeLog	(revision 37792)
@@ -1,3 +1,9 @@
+Thu Nov 22 12:52:19 2012  Akinori MUSHA  <knu@i...>
+
+	* test/ruby/test_string.rb (TestString#test_index): Add some
+	  corner cases to tests for String#index, which might fail if ruby
+	  directly used a buggy memmem(3) implementation.
+
 Thu Nov 22 08:06:42 2012  Narihiro Nakamura  <authornari@g...>
 
 	* test/ruby/test_gc.rb (test_profiler_clear): fix wrong method
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 37791)
+++ test/ruby/test_string.rb	(revision 37792)
@@ -830,6 +830,13 @@
     assert_nil(S("hello").index(S("z")))
     assert_nil(S("hello").index(/z./))
 
+    assert_equal(0, S("").index(S("")))
+    assert_equal(0, S("").index(//))
+    assert_nil(S("").index(S("hello")))
+    assert_nil(S("").index(/hello/))
+    assert_equal(0, S("hello").index(S("")))
+    assert_equal(0, S("hello").index(//))
+
     o = Object.new
     def o.to_str; "bar"; end
     assert_equal(3, "foobarbarbaz".index(o))

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

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