On Thu, Feb 14, 2013 at 2:57 PM, Iustin Pop <[email protected]> wrote:

> On Wed, Feb 06, 2013 at 01:10:46PM +0100, Michele Tartara wrote:
> > In order to fetch precise information about the uptime of the VMs
> > running in Xen, we need to analyze the output of the "xm uptime" command.
> >
> > This commit adds the parser to do that, and its tests.
> > +-- | Test whether a randomly generated UptimeInfo text line can be
> parsed.
> > +prop_uptimeInfo :: UptimeInfo -> Property
> > +prop_uptimeInfo uInfo =
> > +  case A.parseOnly uptimeLineParser . pack . serializeUptime $ uInfo of
> > +    Left msg -> fail $ "Parsing failed: " ++ msg
> > +    Right obtained -> obtained ==? uInfo
>
> You have a lot of this construct. Why not add a function:
>
> eitherCheck :: Either String b -> (b -> Property) -> Property
> eitherCheck (Left msg) _ = fail $ "Parsing failed: " ++ msg
> eitherCheck (Right v) prop = prop v
>
> and simplify the tests?
>
> Makes sense.
I'll have a look at it and, in case, send an interdiff.


> In any case, LGTM.
>
>
Thanks,
Michele

Reply via email to