[#35036] Intentional Programming — "John" <nojgoalbyspam@...>

Hi all

17 messages 2002/03/01

[#35112] RDoc question — Michael Davis <mdavis@...>

I have a question about RDoc. I would like to reference an external

17 messages 2002/03/02

[#35162] string to array and back — Ron Jeffries <ronjeffries@...>

I am needing to convert strings to arrays of bytes and back. I see pack and

19 messages 2002/03/03

[#35364] file reading impossibly slow? — Ron Jeffries <ronjeffries@...>

So I'm doing this benchmark to work with my set program. Part of the problem is

18 messages 2002/03/07

[#35429] Interesting link on static/dynamic typing... — Robert Feldt <feldt@...>

...relevant to Ruby compared to other languages discussion:

25 messages 2002/03/08
[#35441] Re: Interesting link on static/dynamic typing... — Paul Brannan <paul@...> 2002/03/08

On Fri, Mar 08, 2002 at 05:34:43PM +0900, Robert Feldt wrote:

[#35460] Spam, ruby-talk, and me — Dave Thomas <Dave@...>

14 messages 2002/03/08

[#35537] Confusion — David Corbin <dcorbin@...>

The following is from my debugging through xmlc.rb

16 messages 2002/03/10

[#35579] RE: WIN32OLE and LDAP — "Morris, Chris" <chris.morris@...>

> The new version 0.4.2 of Win32OLE has WIN32OLE.bind method.

16 messages 2002/03/11

[#35652] Method type 'abstract' — Peter Hickman <peter@...>

The one thing I miss in Ruby is the abstract class method to go along

15 messages 2002/03/12

[#35653] Some potential RCRs — "Bob Alexander" <bobalex@...>

Here are a few thing I am considering submitting as RCRs. I'm looking =

50 messages 2002/03/12
[#35672] Re: Some potential RCRs — matz@... (Yukihiro Matsumoto) 2002/03/12

Hi,

[#35683] Re: Some potential RCRs — Massimiliano Mirra <list@...> 2002/03/12

On Wed, Mar 13, 2002 at 03:58:01AM +0900, Yukihiro Matsumoto wrote:

[#35697] Re: Some potential RCRs — David Alan Black <dblack@...> 2002/03/13

Hello --

[#35694] rpkg 0.3 — Massimiliano Mirra <list@...>

14 messages 2002/03/13
[#35699] RE: [ANN] rpkg 0.3 — <james@...> 2002/03/13

>

[#35787] testunit - setup -> set_up ? — "Morris, Chris" <chris.morris@...>

I'm just starting to use testunit instead of rubyunit ... I noticed with an

21 messages 2002/03/13
[#35793] RE: testunit - setup -> set_up ? — "Nathaniel Talbott" <nathaniel@...> 2002/03/13

Morris, Chris [mailto:chris.morris@snelling.com] wrote:

[#35796] Re: testunit - setup -> set_up ? — Dave Thomas <Dave@...> 2002/03/13

"Nathaniel Talbott" <nathaniel@talbott.ws> writes:

[#35797] RE: testunit - setup -> set_up ? — "Nathaniel Talbott" <nathaniel@...> 2002/03/13

dave@thomases.com [mailto:dave@thomases.com] wrote:

[#35898] camelCase and underscore_style — "Morris, Chris" <chris.morris@...>

First, a question. If underscore_style is the Ruby norm for methods and the

20 messages 2002/03/15
[#35924] Re: camelCase and underscore_style — "Guy N. Hurst" <gnhurst@...> 2002/03/15

Phil Tomson wrote:

[#35930] RE: camelCase and underscore_style — "Nathaniel Talbott" <nathaniel@...> 2002/03/16

Guy N. Hurst [mailto:gnhurst@hurstlinks.com] wrote:

[#35989] ANN: Locana GUI and GUI Builder version 0.81 — Michael Davis <mdavis@...>

I am pleased to announce release 0.81 of Locana. Locana is a GUI

16 messages 2002/03/16

[#35992] XPath — Michael Schuerig <schuerig@...>

27 messages 2002/03/16

[#36034] Mini Rant: Indenting — Thomas Hurst <tom.hurst@...>

Why is it that I see *so* much code like:

14 messages 2002/03/17

[#36049] web templating for static sites? — Massimiliano Mirra <list@...>

I'm using the Template Toolkit for generating static web sites and I

42 messages 2002/03/17
[#36426] web standars (was: web templating for static sites?) — Tobias Reif <tobiasreif@...> 2002/03/20

Albert Wagner wrote:

[#36052] Xml Serialization for Ruby — "Chris Morris" <chrismo@...>

=Xml Serialization for Ruby

20 messages 2002/03/17
[#36059] Re: [ANN] Xml Serialization for Ruby — Massimiliano Mirra <list@...> 2002/03/17

On Mon, Mar 18, 2002 at 05:20:56AM +0900, Chris Morris wrote:

[#36067] eval/Module question — David Corbin <dcorbin@...>

If I have a String src that is similar to the following:

13 messages 2002/03/18

[#36157] Development of Windows version of Ruby — ptkwt@...1.aracnet.com (Phil Tomson)

Now that we've dumped the cygwin requirement for the Windows version of

63 messages 2002/03/18
[#36330] Re: Development of Windows version of Ruby — Ron Jeffries <ronjeffries@...> 2002/03/19

On Tue, 19 Mar 2002 14:05:27 GMT, "Albert L. Wagner" <alwagner@uark.edu> wrote:

[#36431] Re: Development of Windows version of Ruby — Dennis Newbold <dennisn@...> 2002/03/20

[#36458] Windows version of Ruby (proposals) — ptkwt@... (Phil Tomson) 2002/03/21

Dennis Newbold <dennisn@pe.net> wrote in message news:<Pine.GSO.3.96.1020320113603.22242B-100000@shell2>...

[#36482] RE: Windows version of Ruby (proposals) — "Christian Boos" <cboos@...> 2002/03/21

Some thoughts on the 2 first Windows issues, plus a 4th one...

[#36496] Re: Windows version of Ruby (proposals) — Dave Thomas <Dave@...> 2002/03/21

"Christian Boos" <cboos@bct-technology.com> writes:

[#36510] Re: Windows version of Ruby (proposals) — nobu.nokada@... 2002/03/21

Hi,

[#36514] Re: Windows version of Ruby (proposals) — Dave Thomas <Dave@...> 2002/03/21

nobu.nokada@softhome.net writes:

[#36518] Re: Windows version of Ruby (proposals) — nobu.nokada@... 2002/03/21

Hi,

[#36211] dots in Dir.entries — matz@... (Yukihiro Matsumoto)

Hi,

22 messages 2002/03/19

[#36231] style choice — Ron Jeffries <ronjeffries@...>

A style question for the community ... which of the following do you prefer, and

18 messages 2002/03/19

[#36345] ANN: REXML 2.0 — Sean Russell <ser@...>

I have a feeling there will only be three major revisions of REXML. Version

19 messages 2002/03/20

[#36610] Re: Windows version of Ruby (proposals) — Ron Jeffries <ronjeffries@...>

On Thu, 21 Mar 2002 14:11:55 GMT, Dave Thomas <Dave@PragmaticProgrammer.com> wrote:

16 messages 2002/03/22

[#36645] Ruby for Mac OS 10.1 — Jim Freeze <jim@...>

Hi:

28 messages 2002/03/23

[#36768] Re: Difference between 'do' and 'begin' — Clemens Hintze <c.hintze@...>

In <slrna9ulvi.f2h.mwg@fluffy.isd.dp.ua> Wladimir Mutel <mwg@fluffy.isd.dp.ua> writes:

23 messages 2002/03/26
[#36783] RE: Difference between 'do' and 'begin' — <james@...> 2002/03/26

[#36792] Re: Difference between 'do' and 'begin' — Kent Dahl <kentda@...> 2002/03/26

james@rubyxml.com wrote:

[#36808] Error calling Tk in a loop — <james@...>

I'm trying to write some code that pops up a Tk window when for certain

15 messages 2002/03/26

[#36841] RE: Windows version of Ruby (proposals) — "Andres Hidalgo" <sol123@...>

I believe that Ruby has a place in windows (Office), I happened to have

14 messages 2002/03/27

[#36863] Hash.new(Hash.new) doesn't use Hash.new as default value — "Jonas Delfs" <jonas@...>

Hi -

18 messages 2002/03/27

[#37080] Why isn't Math object-oriented? — Bil Kleb <W.L.Kleb@...>

So I'm reading along in the Pixaxe book (yet again), and I am told

15 messages 2002/03/30

[#37121] String#begins?(s) — timsuth@... (Tim Sutherland)

class String

24 messages 2002/03/31

Re: Rubicon -> Test::Unit [long]

From: Bil Kleb <W.L.Kleb@...>
Date: 2002-03-20 05:41:52 UTC
List: ruby-talk #36366
Bil Kleb wrote:
> 
> Are there plans a foot for Rubicon to use Test::Unit?
> 
> I ask because we currently use Rubicon's BulkTestRunner
> to summarize our RubyUnit test results.

So, apparently being too impatient for an answer, I stole the
pertinent bits from rubicon, somehow(?!) modified them to
work with Test::Unit (including adding attr_readers for failures
and errors to Test::Unit::TestResult), and created a stand-alone
BulkTestRunner which runs all the tests in all the files that
it is passed and produces a rubicon-style summary, e.g.,

 ========================================================================
 Mobility Test Summary         Test Results
 ========================================================================
                  Name   OK?   Tests  Asserts      Failures   Errors
             ------------------------------------------------------------
             Array2DUT             3        6
     BoundaryProfileUT             7       31
                 .                 .        .
             PhysicsUT             3        8
              VectorUT             6        7
 ========================================================================
          All 17 files            80      231          0        0
 ========================================================================

This was produced by the following script, run in a directory containing
a bunch of files where files containing UnitTests all ending with "UT.rb".

 <file name="RunAllTests.rb">
  #!/usr/bin/env ruby
  require 'test/unit/ui/console/bulktestrunner'
  tests = Test::Unit::UI::Console::BulkTestRunner.new([],"Mobility Test Summary")
  Dir["*UT.rb"].each{|ut| tests.addFile(ut)}
  tests.run
 </file>

Here's bulktestrunner.rb for those crazy enough to still be reading along...

# $RCSfile: bulktestrunner.rb,v $

# An incarnation of Dave Thomas's rubicon BulkTestRunner
# (and associated ascii summary output) adapted for use
# with Test::Unit

# $Mangler: Bil Kleb <W.L.Kleb@LaRC.NASA.Gov> $
# $Date: 2002/03/20 03:08:39 $
# $Revision: 1.1 $

require 'test/unit/ui/console/testrunner'

module Test
 module Unit
  module UI
   module Console

    # Run sets of tests in multiple files. This would be a TestSuite,
    # but we want to run each file separately, and to summarize the
    # results differently.

    class BulkTestRunner

     def initialize(args, group_name='')
      @files     = Array.new
      @results   = ResultGatherer.new
      @results.name = group_name
     end

     # Push a file onto the array of files to process.
     def addFile(fileName)
      @files.push fileName
     end

     # Invoke the TestRunner for each file and collect the results.
     # Finally, produce the report.
     def run
      @files.each do |file|
       require file
       className = File.basename(file)
       className.sub!(/\.rb$/, '')
       klass = eval className
       runner = Test::Unit::UI::Console::TestRunner.new(klass.suite, true)
       $stderr.print "\n", className, ": "
       @results.add(klass, runner.start)
      end

      reporter = ResultDisplay.new(@results)
      reporter.reportOn $stdout
      @results.failure_count
     end

    end # class BulkTestRunner

    # This is where we gather the results of all the tests.

    class ResultGatherer

     attr_accessor :name
     attr_reader   :results
     attr_reader   :failure_count

     def initialize(name='')
      @name = name
      @results = Hash.new
      @failure_count = 0
     end

     def add(klass, result_set)
      @results[klass.name] = Results.new.initialize_from(result_set)
      @failure_count += result_set.error_count + result_set.failure_count
     end
     
    end # class ResultGatherer

    # Objects of this class get generated from the TestResult
    # passed back by Test::Unit. We don't use it's class for two reasons:
    # 1. We de-couple better this way
    # 2. We can't serialize the Test::Unit class, as it contains IO objects
    
    class Results

     attr_reader :errors
     attr_reader :failures
     attr_reader :run_count
     attr_reader :error_count
     attr_reader :failure_count
     attr_reader :assertion_count

     def initialize_from(test_result)
      @errors           = Failure.from_real_failures(test_result.errors)
      @failures         = Failure.from_real_failures(test_result.failures)
      @run_count        = test_result.run_count
      @error_count      = test_result.error_count
      @failure_count    = test_result.failure_count
      @assertion_count  = test_result.assertion_count
      @passed           = test_result.passed?
      self
     end

     def passed?
      @passed
     end

    end # class Results

    # Record a particular failure, which is a location
    # and an error message. We simply ape the Test::Unit
    # TestFailure class.

    class Failure

     attr_accessor :location
     attr_accessor :message
     
     def Failure.from_real_failures(f)
      f.collect do |a_failure|
       my_f = Failure.new
       my_f.location  = a_failure.location
       my_f.message = a_failure.message
       my_f
      end
     end

    end # class Failure

    # Produce a report, given results.
    
    class ResultDisplay

     LINE_LENGTH = 72
     LINE = '=' * LINE_LENGTH
     Line = ' ' * 12 + '-' * (LINE_LENGTH - 12)
     
     def initialize(gatherer)
      @results = gatherer.results
      @name    = gatherer.name
     end

     # Write a report to the "op" file handle
     def reportOn(op)
      op.puts
      op.puts LINE
      title = "Test Results".center(LINE_LENGTH)
      title[0, @name.length] = @name
      op.puts title
      op.puts LINE
      op.puts "                 Name   OK?   Tests  Asserts      Failures   Errors"
      op.puts Line    
      total_classes = 0
      total_tests   = 0
      total_asserts = 0
      total_fails   = 0
      total_errors  = 0
      total_bad     = 0
      
      format = "%21s   %4s   %4d  %7d  %9s  %7s\n"
      
      names = @results.keys.sort
      for name in names
       res    = @results[name]
       fails  = res.failure_count.nonzero? || ''
       errors = res.error_count.nonzero?   || ''
       
       total_classes += 1
       total_tests   += res.run_count
       total_asserts += res.assertion_count
       total_fails   += res.failure_count
       total_errors  += res.error_count
       total_bad     += 1 unless res.passed?
       
       op.printf format,
	name.sub(/^Test/, ''),
	res.passed? ? "    " : "FAIL",
	res.run_count, res.assertion_count, 
	fails.to_s, errors
      end
      
      op.puts LINE
      if total_classes > 1
       op.printf format, 
	sprintf("All %d files", total_classes),
	total_bad > 0 ? "FAIL" : "    ",
	total_tests, total_asserts,
	total_fails, total_errors
       op.puts LINE
      end
      
      if total_fails > 0
       op.puts
       op.puts "Failure Report".center(LINE_LENGTH)
       op.puts LINE
       left = total_fails
       
       for name in names
	res = @results[name]
	if res.failure_count > 0
	 op.puts
	 op.puts name + ":"
	 op.puts "-" * name.length.succ
	 
	 res.failures.each do |f|
	  f.location.each do |at|
	   break if at =~ /rubicon/
	   op.print "    ", at, "\n"
	  end
	  err = f.message.to_s
	  
	  if err =~ /expected:(.*)but was:(.*)/m
	   exp = $1.dump
	   was = $2.dump
	   op.print "    ....Expected: #{exp}\n"
	   op.print "    ....But was:  #{was}\n"
	  else
	   op.print "    ....#{err}\n"
	  end
	 end
	 
	 left -= res.failure_count
	 op.puts
	 op.puts Line if left > 0
	end
       end
       op.puts LINE
      end
      
      if total_errors > 0
       op.puts
       op.puts "Error Report".center(LINE_LENGTH)
       op.puts LINE
       left = total_errors
       
       for name in names
	res = @results[name]
	if res.error_count > 0
	 op.puts
	 op.puts name + ":"
	 op.puts "-" * name.length.succ
	 
	 res.errors.each do |f|
	  f.location.each do |at|
	   break if at =~ /rubicon/
	   op.print "    ", at, "\n"
	  end
	  err = f.message.to_s
	  op.print "    ....#{err}\n"
	 end
	 
	 left -= res.error_count
	 op.puts
	 op.puts Line if left > 0
	end
       end
       op.puts LINE
      end
     end # def reportOn

    end # class ResultDisplay

   end # module Console
  end # module UI
 end # module Unit
end # module Test

Just to be complete and *extra long*, here is a sample UnitTest file,

 <file name="CellUT.rb">
  require 'test/unit'
  require 'Cell'

  class CellUT < Test::Unit::TestCase
   def set_up
    @state    = 0.2
    @aCell    = Cell.new(@state)
   end
   def testCreation
    assert_equal(@state,@aCell.state)
    @aCell = Cell.new()
    assert_equal(0, @aCell.state)
    assert_equal(0,@aCell.deltaUi)
    assert_equal(0,@aCell.deltaUj)
   end
   def testUpdateDisabled
    assert_equal(0,@aCell.update)
   end
  end
 </file>

-- 
Bil Kleb
NASA Langley Research Center
Hampton, Virginia, USA

In This Thread