Problem with "require" stmt in "test-first " tutorial

Hi All,

“Test First, by Intention” at
http://www.rubycentral.com/articles/pink/
provides a small example that failed on the follow require statements:

require 'runit/testcase’
require ‘summarizer’

I’m running Ruby 1.6.8 over Win2000SP3 with a few Ruby symbols
defined, in particular:

RUBYPATH=I:\Program Files\Ruby:

I got the first “require” to pass muster by converting it to:

RubyPkgs1point6 = "I:\Program
Files\Ruby\lib\ruby\site_ruby\1.6\"
require RubyPkgs1point6 + ‘runit\testcase’

However, “summarizer” doesn’t seem to be included in my Ruby
installation. Anyone know how I can fix this problem?

TIA,
Richard

your ‘Sum’ class should be stored in a file named ‘summarizer.rb’

your ‘TestSummarizer’ class should be stored in another file, perhaps
named ‘test_summarizer.rb’.

I looked briefly in the tutorial and it seems like they don’t mention
that ‘Sum’ should go to ‘summarizer.rb’… Maybe it would be a good idea
to add it to the tutorial ?

···

On Thu, 05 Jun 2003 15:03:39 +0000, Richard wrote:

“Test First, by Intention” at
http://www.rubycentral.com/articles/pink/
provides a small example that failed on the follow require statements:

However, “summarizer” doesn’t seem to be included in my Ruby
installation. Anyone know how I can fix this problem?


Simon Strandgaard

Hi,

···

At Fri, 6 Jun 2003 06:21:13 +0900, Richard wrote:

I’m running Ruby 1.6.8 over Win2000SP3 with a few Ruby symbols
defined, in particular:

RUBYPATH=I:\Program Files\Ruby:

RUBYPATH is used only with -S option but doesn’t affect
“require” at all. You may want to use RUBYLIB instead.


Nobu Nakada

Hi Nobu and Simon,

Thank you both for your responses.

RUBYLIB

···

I added the environment variable RUBYLIB as you advised me. I added:
RUBYLIB=I:\Program Files\Ruby\lib\ruby\site_ruby\1.6
to my system, which facilitated the search for
require ‘runit\testcase’

That definition seemed excessively detailed compared to my RUBYPATH
definition
RUBYPATH=I:\Program Files\Ruby
so I reduced it to
RUBYLIB=I:\Program Files\Ruby\lib
in a subsequent project and that seemed to work fine. I trust you
agree that this is the appropriate RUBYLIB definition.

Question: Can multiple libraries be concatenated in the RUBYPATH
definition. If so, what is the delimiter to be used on a Win2000Pro
platform? Semicolon or colon?

Unit Testing

I couldn’t get the test example to work, despite your generous help.
(I’m a Ruby newbie.) So I found a simpler example from Hal Fulton at
http://rubyhacker.com/domo.html

Based on that, I wrote the following:

require “test/unit”

class Sample
def initialize
end

def to_s
	%q[Hi, I'm "Sample"]
end

end

class Tester < Test::Unit::TestCase

def test001
	sample = Sample.new
	puts sample
end

end

This produced the following output (when running under SciTe on
Win2000Pro):

ruby UnitTestExample2.rb
Hi, I’m “Sample”
Loaded suite UnitTestExample2
Started…

Finished in 0.01 seconds.
1 runs, 0 assertions, 0 failures, 0 errors
Exit code: 0

Question: This output is a distortion from the output obtained when
running the script in a Command window. It looks like SciTe treats
the output from the script proper via “puts” distinctly from output
from the “unit” package, so that they are presented out of order in
the output pane.

I’m happy to have Unit Tesing working, but I’d like to know the
details about SciTe so that I interpret output from future usage
correctly.

Thanks again to you both for your help.

Regards,
Richard

This article provides links to online version of the Pink book but they are dead.

Anyone one knows where is possible to find online version of Pink book?

Sincerely,
Gour

···

Richard (RLMuller@comcast.net) wrote:

“Test First, by Intention” at
http://www.rubycentral.com/articles/pink/


Gour
gour@mail.inet.hr
Registered Linux User #278493

Hi everybody,

I am trying to build ruby from CVS using VC++.
I did:

cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src co ruby
cd ruby
win32\configure i686-mswin32
nmake

and I am getting an error:

  cl -nologo -MD -Zi -O2b2xg- -G6 -DRUBY_EXPORT -I. -I./.. -I.
-I./.. -I./../missing -c -Tc./../process.c
process.c
./../process.c(48) : fatal error C1083: Cannot open include file:
'grp.h': No such file or directory

Is this Unix related include file? What am I doing wrong?

Thanks,

Yura.

I’m just a testing newbie, but i think that no output should be produced from
automatic tests. That’s not XP way i guess. All tests must be done via
assertions.

kick me if i’m wrong

···

On Sunday 08 June 2003 07:32, Richard wrote:

Question: This output is a distortion from the output obtained when
running the script in a Command window. It looks like SciTe treats
the output from the script proper via “puts” distinctly from output
from the “unit” package, so that they are presented out of order in
the output pane.

I’m happy to have Unit Tesing working, but I’d like to know the
details about SciTe so that I interpret output from future usage
correctly.


sdmitry -=- Dmitry V. Sabanin
MuraveyLabs.

Works okay for me.

···

on 6/9/03 10:28 AM, Gour at gour@mail.inet.hr wrote:

Richard (RLMuller@comcast.net) wrote:

“Test First, by Intention” at
http://www.rubycentral.com/articles/pink/

This article provides links to online version of the Pink book but they are
dead.

Anyone one knows where is possible to find online version of Pink book?


Regards,
JJ

Finally using a Mac!

hi list.
i am very new to ruby. mostly i develop in php oop. but the image library
sucks in php and php is dam slow.
i am working on a private project were i send huge amount of data discribing
mainly polygons in svg format from a web client. this need to get written to
jpeg format on the server site. i saw some great examples of ruby using
packages for writing images. but i am pretty lost in the world of ruby.
can anybody give me a hint where to look to get me on the right train?
would be very nice and finally would get me into ruby more.
thanx
niels

“Yura” yura@opmr.com wrote in message news:EKELLLIDKIEKJAHAENGAGEDIFPAA.yura@opmr.com

Hi everybody,

I am trying to build ruby from CVS using VC++.
I did:

cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src co ruby
cd ruby
win32\configure i686-mswin32
nmake

and I am getting an error:

  cl -nologo -MD -Zi -O2b2xg- -G6 -DRUBY_EXPORT -I. -I./.. -I.

-I./… -I./…/missing -c -Tc./…/process.c
process.c
./…/process.c(48) : fatal error C1083: Cannot open include file:
‘grp.h’: No such file or directory

Is this Unix related include file? What am I doing wrong?

Thanks,

Yura.

You could try searching your disk for files containing HAVE_GETGRENT;
(in either -D option or #define).

One is ext\etc.c

#ifdef HAVE_GETGRENT
#include <grp.h>
#endif

but I don’t see Ruby config defining this anywhere.

Try adding option -UHAVE_GETGRENT in the MAKEFILE, then retry nmake.

If you know of a better way of adding ‘#undef HAVE_GETGRENT’. your way
will be better :wink:

I’m fairly confident this won’t get you much further.

daz

Dmitry V. Sabanin wrote:

Richard wrote:

Question: This output is a distortion from the output obtained when
running the script in a Command window. It looks like SciTe treats
the output from the script proper via “puts” distinctly from output
from the “unit” package, so that they are presented out of order in
the output pane.

I’m just a testing newbie, but i think that no output should be produced
from
automatic tests. That’s not XP way i guess. All tests must be done via
assertions.

The “XP way” does not specify the innards of the *Unit lineage of test rigs.

For historical (or possibly hysterical) reasons, those test rigs bunch up
the diagnoses from the assertions, and reveal them at the end.

I personally feel this is Big Test Up Front territory, and against the
ideals of TDD.

Specifically, TDD is completely interactive. The test rig is a programmer’s
interface.

I may want to say assert(x); exit(0), run the tests only to that point, but
still read the diagnostics.

I’m happy to have Unit Tesing working, but I’d like to know the
details about SciTe so that I interpret output from future usage
correctly.

Done right ( :wink: there’s no reason to say assert(x); exit(0). One should
only have a few diagnostics at a time, related to ones most recent edit.

Because TDD so often leads to doing things right, this hysterical feature
isn’t generally regarded as a problem.

···


Phlip
http://www.c2.com/cgi/wiki?TestFirstUserInterfaces

kick me if i’m wrong

Hi Dmitry,

I won’t “kick you” even though, IMHO, you’re wrong :-). The output

Hi, I’m “Sample”
Loaded suite UnitTestExample2
Started…

Finished in 0.01 seconds.
1 runs, 0 assertions, 0 failures, 0 errors

Only the first of the lines was from my test code. The rest were from
the unit test environment itself. The problem is that running the
same test in a Command window produces an inconsistent result: the “Hi
…” line is displayed immediately after the “Started …” line rather
than in the first position.

Regards,
Richard

···

from my test run under SciTe was:

Well, I’m wonder hot it’s possible.

The links point to: ftp://ftp.xprogramming.com/ftp/xpinstall.pdf & xpinstallpdf.zip.

By directly connecting to ftp.xprogramming.com I see the following:

ncftp /ftp > pwd
ftp://ftp.xprogramming.com/ftp/
ncftp /ftp > ls -al
drwx—r-x 2 system System 0 Aug 30 16:18 .
drwx—r-x 2 system System 0 Aug 30 16:18 …
-rwx—r-x 1 system System 29755 Jul 6 2000 Optional+scope+contracts.pdf
-rwx—r-x 1 system System 47104 Sep 13 2001 Release Results.doc
-rwx—r-x 1 system System 24064 Sep 13 2001 Release Results.xls
drwx—r-x 2 system System 0 Jul 3 21:12 TestingFramework
-rwx—r-x 1 system System 289792 Sep 17 2001 User Stories and Planning Game XPI.ppt
-rwx—r-x 1 system System 560640 Sep 11 2000 XP 2000 Slides.ppt
drwx—r-x 2 system System 0 Oct 25 2000 _vti_cnf
ncftp /ftp >

and unfortunately I cannot see neither *.zip nor *.pdf version.

However, I’ll appreciate to become enlightened to see them.

Of, course I’d not complain to receive one in my Inbox :slight_smile:

Sincerely,
Gour

···

John Johnson (jj5412@earthlink.net) wrote:

Anyone one knows where is possible to find online version of Pink book?

Works okay for me.


Gour
gour@mail.inet.hr
Registered Linux User #278493

Sorry, my reply was a bit hasty. I clicked on the link in your email and it
worked. Obviously, I didn’t read/retain what you were asking. I’ve been
Googling and haven’t been able to find anything either.

Sorry,
JJ

···

on 6/9/03 11:23 AM, John Johnson at jj5412@earthlink.net wrote:

on 6/9/03 10:28 AM, Gour at gour@mail.inet.hr wrote:

Richard (RLMuller@comcast.net) wrote:

“Test First, by Intention” at
http://www.rubycentral.com/articles/pink/

This article provides links to online version of the Pink book but they are
dead.

Anyone one knows where is possible to find online version of Pink book?

Works okay for me.

ImageMagick supports the SVG 1.0 PATH element. You can also translate
other SVG elements into Ruby method calls. You can use the RMagick
extension to call ImageMagick from Ruby scripts. See
http://home.nc.rr.com/rmagick for examples.

Email me if you want details.

···

On Tue, 10 Jun 2003 00:55:50 +0900, niels wolf wrote:

hi list.
i am very new to ruby. mostly i develop in php oop. but the image
library sucks in php and php is dam slow.
i am working on a private project were i send huge amount of data
discribing mainly polygons in svg format from a web client. this need to
get written to jpeg format on the server site. i saw some great examples
of ruby using packages for writing images. but i am pretty lost in the
world of ruby. can anybody give me a hint where to look to get me on the
right train? would be very nice and finally would get me into ruby more.
thanx
niels

From: daz [mailto:dooby@d10.karoo.co.uk]
Sent: June 8, 2003 01:34

“Yura” yura@opmr.com wrote in message

and I am getting an error:

  cl -nologo -MD -Zi -O2b2xg- -G6 -DRUBY_EXPORT -I. -I./.. -I.

-I./… -I./…/missing -c -Tc./…/process.c
process.c
./…/process.c(48) : fatal error C1083: Cannot open include file:
‘grp.h’: No such file or directory

You could try searching your disk for files containing HAVE_GETGRENT;
(in either -D option or #define).

One is ext\etc.c

#ifdef HAVE_GETGRENT
#include <grp.h>
#endif

but I don’t see Ruby config defining this anywhere.

HAVE_GETGRENT is not defined. The problem is not with etc.c but with
process.c that unconditionally includes grp.h. I’ve tried to put
#ifdef HAVE_GETGRENT around grp.h in process.c but then I have link
errors:

process.obj : error LNK2001: unresolved external symbol _getgroups
process.obj : error LNK2001: unresolved external symbol _setgroups
process.obj : error LNK2001: unresolved external symbol _getgrnam
miniruby.exe : fatal error LNK1120: 3 unresolved externals

I’m fairly confident this won’t get you much further.

True.

I wonder how did Andy build it?

Yura.

···

-----Original Message-----

Is this one OK?
ftp://ftp.ips.cs.tu-bs.de/www/ips/zuendorf/lehre/rse/xpinstall.pdf

···

On Tue, Jun 10, 2003 at 01:14:59AM +0900, Gour wrote:

John Johnson (jj5412@earthlink.net) wrote:

Anyone one knows where is possible to find online version of Pink book?

Works okay for me.

Well, I’m wonder hot it’s possible.

The links point to: ftp://ftp.xprogramming.com/ftp/xpinstall.pdf & xpinstallpdf.zip.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

When a float occurs on the same page as the start of a supertabular
you can expect unexpected results.
– Documentation of supertabular.sty

I wonder how did Andy build it?

Yura.

I fear you’ve hit ‘work in progress’.

I missed this unconditional include because it’s been added since
15 May and Andy’s build was from around then.
Could you manage with sources prior to 06 Jun and compile from them ?

CVS is probably magical enough to allow that, or there’s

ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz

(circa 30 May)

If you want it WinZipped, give me an OK by email and
I’ll have it ready.

Cheers,

daz

···

----- Original Message -----
From: “Yura” yura@opmr.com
Newsgroups: comp.lang.ruby
Sent: Sunday, June 08, 2003 7:03 AM
Subject: Re: Building ruby under Windows

Well, this one is MUCH better :slight_smile:

Thanks a lot.

Sincerely,
Gour

···

Mauricio Fernández (batsman.geo@yahoo.com) wrote:

Is this one OK?
ftp://ftp.ips.cs.tu-bs.de/www/ips/zuendorf/lehre/rse/xpinstall.pdf


Gour
gour@mail.inet.hr
Registered Linux User #278493

Thanks, this one compiles, but it is 1.6.8 and I wanted 1.8.0 :frowning:

···

-----Original Message-----
From: daz [mailto:dooby@d10.karoo.co.uk]
Sent: June 8, 2003 03:34
To: ruby-talk ML
Subject: Re: Building ruby under Windows

I fear you’ve hit ‘work in progress’.

I missed this unconditional include because it’s been added since
15 May and Andy’s build was from around then.
Could you manage with sources prior to 06 Jun and compile from them ?

CVS is probably magical enough to allow that, or there’s

ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz

(circa 30 May)