[Rubytests-commit] rubicon/builtin TestString.rb

holmberg at rubyforge.org holmberg at rubyforge.org
Thu Aug 25 18:01:32 EDT 2005


Update of /var/cvs/rubytests/rubicon/builtin
In directory rubyforge.org:/tmp/cvs-serv21766

Modified Files:
	TestString.rb 
Log Message:
Added comments in the code explaining the use of the variable @cls
and and the utility method S().

Short summary: it makes it possible to test other "stringlike" classes
using the same test-code as now. This possibility has not been used
yet, and will probably require some further reorganization of the
code.



Index: TestString.rb
===================================================================
RCS file: /var/cvs/rubytests/rubicon/builtin/TestString.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TestString.rb	25 Aug 2005 21:53:39 -0000	1.9
--- TestString.rb	25 Aug 2005 22:01:30 -0000	1.10
***************
*** 3,6 ****
--- 3,25 ----
  require 'rubicon'
  
+ #
+ # The tests in this file are written in terms of "stringlike" objects
+ # instead of using the class "String" directly. The purpose of this is
+ # to make it possible to test other stringlike classes too (a simple
+ # example would be to test a subclass of "String", i.e. how the
+ # String-class behaves when sub-classed).
+ #
+ # This flexibility has not been used yet, but will soon ...
+ #
+ # It is implemented by having the member variable @cls initialized to
+ # the stringlike class we want to test. The S() utility method (used
+ # "everywhere" in this file) converts String objects to stringlike
+ # objects of the class @cls.
+ #
+ # This file will probably need to splitted again when another class
+ # is tested too. Something like "TestString.rb", "TestStringSubclass.rb"
+ # and "StringBase.rb".
+ #
+ 
  # use of $= is deprecated after 1.7.1
  def pre_1_7_1
***************
*** 36,39 ****
--- 55,62 ----
    end
  
+   # The "S" method converts String objects into objects of the
+   # stringlike class given in the variable @cls. The parameter to
+   # "S" may be either a single String, or an array of Strings.
+   #
    def S(str_or_array)
      if str_or_array.instance_of?(Array)



More information about the Rubytests-commit mailing list