[R] RUnit detects parse error, but why?

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 10 19:05:33 CEST 2009


On 7/10/2009 11:53 AM, Seeliger.Curt at epamail.epa.gov wrote:
> Folks,
> 
> An RUnit test suite is failing after all tests are complete with the 
> following message:
> 
>         Error in parse(n = -1, file = file) : unexpected '}' at
>         620: 
>         621: }
> 
> All individual tests work when run individually, and all but one run 
> within the RUnit test suite.  What might be causing this?

You need to take a look at the file that was being passed to parse.  One 
way to do this is to set options(error=recover) before running whatever 
led to this.  When the error occurs, you'll see a stack trace, and you 
can try to get the file.  If it's a real file, then things are easy: 
just see why the brace on line 621 doesn't match anything.  But since 
the message doesn't give a name, it's probably something else:  a pipe, 
or textConnection, or whatever.

Duncan Murdoch

> 
> A similar error message during package creation was discussed earlier this 
> year (http://tolstoy.newcastle.edu.au/R/e6/help/09/03/6757.html) with the 
> suggestion to separately source all of the .r files.  Since the files all 
> source() and run just fine, it looks like the problem may be in RUnit.
> 
> Thanks,
> cur
>




More information about the R-help mailing list