Version française
Home     About     Download     Resources     Contact us    
Browse thread
Testing Camlp4-generated code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: Re: [Caml-list] Testing Camlp4-generated code
On Sat, 5 Nov 2005, Matt Gushee wrote:

> I have developed a tool that generates a module using Camlp4, and I
> would like to be able to test the output. The structure is fairly small
> and simple, so it should be sufficient to verify that a generated module
> is equivalent to a certain hand-coded module ... but is there a reliable
> way to do that?

My 2 cents:
   camlp4o pa_yourextension.cmo pr_o.cmo input.ml > auto.ml
   camlp4o manual.ml > manual2.ml
   diff auto.ml manual2.ml

Of course if you have a lot of automatic identifiers, that's not very 
convenient. But at least you will get the same indentation if your 
identifiers have the same length.


> If it makes a difference, the output consists mainly of two values: a
> data structure which is of an abstract type, and an object. The former
> is implemented as follows:
>
>   type data = S of string | L of string list | D of t
>   and t = {
>     data : (string, data) Hashtbl.t;
>     mutable locked : bool;
>   }
>
> and the latter is an immediate object, but it inherits from a class
> defined in another module. The object is associated with two instances
> of the above type, has public methods that get and set values, and may
> contain one or more sub-objects similar to itself.
>
> Thanks in advance for any suggestions.
>
> -- 
> Matt Gushee
> Englewood, CO, USA
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

--
Martin Jambon, PhD