[Vala] Unit Testing in Vala

2012-10-19 Thread Steven Oliver
There are a couple of unit testing frameworks out there for Vala. I know
there a multitude of frameworks people have written themselves for
themselves that aren't really published as stand alone projects. Given that
I'd like to start putting some testing in a project I'm working on and I
had a few questions for the audience.

It appears to me that Valadate is the most mature testing platform out
there. I've noticed it's hosted on Gitorious but it appears that Yorba
has cloned it on their server and have made updates to it that never made
it back to Gitorious. It also appears that despite hosting Valadate Yorba
doesn't actually use it. * puzzled *

Is there anything else out there worth looking at? Or at lest ones that
have seen updates in the past 2 years? And finally, what is everyone doing
for unit testing? It appears to be something a lot of projects don't really
do anymore.

Steven N. Oliver
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Need help to make binding for typedef'd pointer struct

2012-10-19 Thread Ahmad Syukri bin Abdollah
Greetings!

Not long ago, someone made a binding for GMP
(https://mail.gnome.org/archives/vala-list/2011-August/msg00048.html)
and posted it on the wiki, but it seems to have been lost.
I'm attempting to write a new one, but came across some design difficulties.

In the original API, the custom number types are structs. To use them,
they are allocated, initialized, and passed to API functions via its
pointer.

  {snip: C example}
  /* declare var using mpz_t, which is typedef'd to the length-1 array
of the struct */
  mpz_t num1, num2;
  /* initialize */
  mpz_init_set_ui(num1, 1495);
  mpz_init_set_si(num2, -30);
  /* do operations */
  mpz_add(num2, num1, num2);

I managed to conjure a simple binding using struct to interface the
original struct, since you can't typedef a pointer struct in Vala.
But then the usage will look like this:

{snip: Vala exampe}
mpz_t num1, num2;
mpz.init_set_ui(out num1, 1495);
mpz.init_set_ui(out num2, 1495);
mpz_add(num2, num1, num2);
// or maybe: mpz_add(out num2, out num1, out num2);

If possible I'd like to avoid having to use ref/out/. A compact class
seems to be a good substitute, since they are passed by reference by
default.
The problem is, class needs a new function, which doesn't exist in
the API (because the types designed as objects).
Can I define what the new function does without having to include an
extra header file?

Regards,
A. Syukri
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] getopt

2012-10-19 Thread David Boesner
Hi everyone,

I want to extract which parameters and values I have passed to my program.
I used getopt, when I solved that problem in c. Is there an vala
counterpart to getopt?

Regards David


*
*
this != here
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [vala] getopt

2012-10-19 Thread David Boesner
Hi everyone,

I want to extract which parameters and values I have passed to my program.
I used getopt, when I solved that problem in c. Is there an vala
counterpart to getopt?

Regards David


*
*
this != here
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] getopt

2012-10-19 Thread Mario Daniel Ruiz
If you want to get the args passed to your program, remember, its int 
main(string args){}
Enviado desde un dispositivo móvil

-Original Message-
From: David Boesner david.boes...@gmail.com
Sender: vala-list-boun...@gnome.org
Date: Thu, 11 Oct 2012 14:18:23 
To: vala-list@gnome.org
Subject: [Vala] getopt

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Need help to make binding for typedef'd pointer struct

2012-10-19 Thread Jonas Kulla
2012/10/3 Ahmad Syukri bin Abdollah syoc...@gmail.com

 Greetings!

 Not long ago, someone made a binding for GMP
 (https://mail.gnome.org/archives/vala-list/2011-August/msg00048.html)
 and posted it on the wiki, but it seems to have been lost.
 I'm attempting to write a new one, but came across some design
 difficulties.

 In the original API, the custom number types are structs. To use them,
 they are allocated, initialized, and passed to API functions via its
 pointer.

   {snip: C example}
   /* declare var using mpz_t, which is typedef'd to the length-1 array
 of the struct */
   mpz_t num1, num2;
   /* initialize */
   mpz_init_set_ui(num1, 1495);
   mpz_init_set_si(num2, -30);
   /* do operations */
   mpz_add(num2, num1, num2);

 I managed to conjure a simple binding using struct to interface the
 original struct, since you can't typedef a pointer struct in Vala.
 But then the usage will look like this:

 {snip: Vala exampe}
 mpz_t num1, num2;
 mpz.init_set_ui(out num1, 1495);
 mpz.init_set_ui(out num2, 1495);
 mpz_add(num2, num1, num2);
 // or maybe: mpz_add(out num2, out num1, out num2);

 If possible I'd like to avoid having to use ref/out/. A compact class
 seems to be a good substitute, since they are passed by reference by
 default.
 The problem is, class needs a new function, which doesn't exist in
 the API (because the types designed as objects).
 Can I define what the new function does without having to include an
 extra header file?

 Regards,
 A. Syukri


Hi!

I think I had a similar problem to yours when writing a vapi for the
popular minizip utilities.
What they did was typedef a void pointer to an opaque type, which was
passed by value,
and it seems to me from the C code you provided that it's the same case
here as well(?).
Anyway, what I did was simply declare the type as a [SimpleType] struct (no
pun intended).
This solution isn't perfect, but it worked for me.

 - Jonas
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Unit Testing in Vala

2012-10-19 Thread Jim Nelson
For the record, Yorba attempted to contact the original developer of Valadate 
and received no response.  We had some testing needs awhile back, and so we 
forked.  The work we did was not to add features, but merely to rip things out 
to get it to compile with the then-current version of Vala.

You are correct, we're not currently using or developing Valadate.  We would 
like it if someone stepped up to take over the project.  The code is most 
likely suffering from bit rot and could use some attention.  Unfortunately, we 
have our hands full with other projects and can't spend the time it would take.

-- Jim

On Fri, Oct 19, 2012 at 6:49 AM, Steven Oliver oliver.ste...@gmail.com wrote:
There are a couple of unit testing frameworks out there for Vala. I know 
there a multitude of frameworks people have written themselves for 
themselves that aren't really published as stand alone projects. Given that 
I'd like to start putting some testing in a project I'm working on and I 
had a few questions for the audience. 

It appears to me that Valadate is the most mature testing platform out 
there. I've noticed it's hosted on Gitorious but it appears that Yorba 
has cloned it on their server and have made updates to it that never made 
it back to Gitorious. It also appears that despite hosting Valadate Yorba 
doesn't actually use it. * puzzled * 

Is there anything else out there worth looking at? Or at lest ones that 
have seen updates in the past 2 years? And finally, what is everyone doing 
for unit testing? It appears to be something a lot of projects don't really 
do anymore. 

Steven N. Oliver 

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Unit Testing in Vala

2012-10-19 Thread Steven Oliver
I am sorry if I made it sound like you guys had done something wrong. That
was not my intention!

Is there a reason you're not currently using it, even if you aren't further
developing it?

Steven N. Oliver

On Fri, Oct 19, 2012 at 3:21 PM, Jim Nelson j...@yorba.org wrote:

 For the record, Yorba attempted to contact the original developer of
 Valadate and received no response.  We had some testing needs awhile back,
 and so we forked.  The work we did was not to add features, but merely to
 rip things out to get it to compile with the then-current version of Vala.

 You are correct, we're not currently using or developing Valadate.  We
 would like it if someone stepped up to take over the project.  The code is
 most likely suffering from bit rot and could use some attention.
  Unfortunately, we have our hands full with other projects and can't spend
 the time it would take.

 -- Jim

 On Fri, Oct 19, 2012 at 6:49 AM, Steven Oliver oliver.ste...@gmail.com
 wrote:

 There are a couple of unit testing frameworks out there for Vala. I know
 there a multitude of frameworks people have written themselves for
 themselves that aren't really published as stand alone projects. Given
 that
 I'd like to start putting some testing in a project I'm working on and I
 had a few questions for the audience.

 It appears to me that Valadate is the most mature testing platform out
 there. I've noticed it's hosted on Gitorious but it appears that Yorba
 has cloned it on their server and have made updates to it that never made
 it back to Gitorious. It also appears that despite hosting Valadate Yorba
 doesn't actually use it. * puzzled *

 Is there anything else out there worth looking at? Or at lest ones that
 have seen updates in the past 2 years? And finally, what is everyone doing
 for unit testing? It appears to be something a lot of projects don't
 really
 do anymore.

 Steven N. Oliver



___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Unit Testing in Vala

2012-10-19 Thread Evan Nemerson
On Fri, 2012-10-19 at 09:49 -0400, Steven Oliver wrote:
 There are a couple of unit testing frameworks out there for Vala. I know
 there a multitude of frameworks people have written themselves for
 themselves that aren't really published as stand alone projects. Given that
 I'd like to start putting some testing in a project I'm working on and I
 had a few questions for the audience.
 
 It appears to me that Valadate is the most mature testing platform out
 there. I've noticed it's hosted on Gitorious but it appears that Yorba
 has cloned it on their server and have made updates to it that never made
 it back to Gitorious. It also appears that despite hosting Valadate Yorba
 doesn't actually use it. * puzzled *
 
 Is there anything else out there worth looking at? Or at lest ones that
 have seen updates in the past 2 years? And finally, what is everyone doing
 for unit testing? It appears to be something a lot of projects don't really
 do anymore.

All of the unit testing projects people have written in Vala which I'm
aware of are now unmaintained.  I think most Vala projects which have
unit tests simply use the testing framework built into GLib.

http://developer.gnome.org/glib/stable/glib-Testing.html
http://valadoc.org/glib-2.0/GLib.Test.html


-Evan

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] getopt

2012-10-19 Thread Evan Nemerson
On Thu, 2012-10-11 at 14:18 +0200, David Boesner wrote:
 Hi everyone,
 
 I want to extract which parameters and values I have passed to my program.
 I used getopt, when I solved that problem in c. Is there an vala
 counterpart to getopt?

You probably want the GLib.Option* stuff.  It is a bit tricky to use
from Vala, but you can use valac as an example:

http://git.gnome.org/browse/vala/tree/compiler/valacompiler.vala

Documentation:

http://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html
http://valadoc.org/glib-2.0/GLib.OptionContext.html


-Evan

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Unit Testing in Vala

2012-10-19 Thread Jim Nelson

On Fri, Oct 19, 2012 at 12:49 PM, Steven Oliver oliver.ste...@gmail.com wrote:
I am sorry if I made it sound like you guys had done something wrong. That was 
not my intention!

No problem.  No offense was taken.

Is there a reason you're not currently using it, even if you aren't further 
developing it?

Unit testing never became a part of the Yorba methodology.  I know that's 
controversial to some, but with our resources, we've elected to keep them on 
features and bug fixes.  I do think it's something we're going to pursue 
(gradually) in the case of Geary, as it has to interoperate with such a variety 
of mail servers and services, it's important we know we haven't broke something.

-- Jim___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list