Hi Pieter,

your first test looks promising. Unfortunately I cannot build the
framework, because of "GitXTesting-Info.plist: No such file or
directory". I suppose you forgot to add this file in your commit.

The second problem (to me) will be, that I'm on Snow Leopard and
therefore MUST use MacRuby 0.5, which in the moment is working in
64bit mode only.

Nevertheless, Macruby is the better choice because RubyCocoa is also
not perfect and is not developed any more, completely apart from the
weird syntax of RubyCocoa (named arguments).

rspec is already used inside by MacRuby, but as a good alternative
there is still bacon. I have tried out it already with MacRuby, it is
working well! (http://github.com/chneukirchen/bacon) I will have a
look on this when I succeed in building the testing framework!

Bernd


On 1 Okt., 22:11, Pieter de Bie <[email protected]> wrote:
> Hi List (and Bernd),
>
> I've recently fiddled a bit with testing GitX with unit tests. Some of
> the stuff tends to break a lot (like the index operations), so having
> something to check this with makes a lot of sense.
>
> For now I've created something that uses MacRuby, and loads in a newly
> created GitXTesting.framework. If somebody has a suggestion for
> something better, I'm all ears, but I know Ruby so this seems like a
> good first try :).
>
> Unfortunately we cannot use the (somewhat more stable) RubyCocoa
> package that also ships with Leopard, because GitX uses Garbage
> Collection. This means we're stuck with MacRuby if we want to use
> Ruby, and MacRuby is still very much under development. I was only
> able to test this with Leopard, as I don't have Snow Leopard yet.
> MacRuby 0.4 works with Leopard, Snow Leopard only works with the trunk
> version of MacRuby. Nightlies for that can be found 
> here:http://macruby.icoretech.org/.
>
> For now it only tests PBGitIndex, and only partially, but these are
> still some important changes and have also revealed two bugs. The
> changes can be found here:http://github.com/pieter/gitx/commits/master
>
> Here's how it works:
>
> * Install MacRuby (either 0.4 for Leopard or a nightly for SL)
> * build the "GitXTesting.framework" target in Debug mode
> * cd test && macruby index.rb
>
> At first I wanted to use rspec, but macgem was not able to install
> that, so I'm not sure if we're stuck with Test::Unit, or whatever. I
> guess future versions of MacRuby will only improve, perhaps the trunk
> version already works better.
>
> There are some caveats:
>
> * You have to manually build the framework and manually run the tests.
> Patches to streamline that (`rake test`?) would be very welcome :)
> * The GitXTesting.framework uses the -DCLI preprocessor define so that
> PBGitRepository doesn't try to open windows on creation :). I should
> refactor PBGitRepository to not be an NSDocument, but rather some
> independent class.
> * The framework uses weak linking, so it might be that when adding
> tests the framework builds fine, but some classes can't be found. In
> that case you have to add those classes to the framework target
> * MacRuby return 0 or 1 for BOOL methods, both of which are true in
> Ruby. So when testing methods returning a BOOL, make sure to use value
> == 0 and value ==1 instead of assert(value).

Reply via email to