11 Jun 2011 joolean   » (Journeyer)

r6rs-protobuf

...version 0.2 is out! Downloads are here. I've added support for default values for optional fields and fixed some issues (mostly around enumerated types) that I discovered along the way.

One thing I noticed while writing SRFI-64 unit tests, though, was how neatly the `environment' procedure in the R6RS `(rnrs eval)' library works for testing code generation. My code generation routines return lists of datums representing expressions for creating the required bindings for a particular data type definition. `environment' allows for the creation of ad hoc "sandboxes" in which these binding expressions can be evaluated -- and in which test expressions can also be evaluated so that you can make assertions about the behavior of the stuff you bound. To wit:


(define test-env (environment '(rnrs)))
(for-each (lambda (expr) (eval expr test-env))
(protoc:generate-message my-message-def))
(test-assert (protobuf:message-builder? (eval '(make-my-message-builder) test-env)))


And you can create a new sandbox for every test, so that you don't have to worry about bindings generated by previous test cases polluting the environment of subsequent test cases that generate code for the same input definitions.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!