On Thu, Jul 18, 2013 at 1:43 PM, hadley wickham <notifications@github.com>wrote:

> In R/expect-that.r:
>
> > @@ -53,6 +55,33 @@ expect_that <- function(object, condition, info = NULL, label = NULL) {
> >    invisible()
> >  }
> >
> > +# find the srcref of the test call, or NULL
> > +find_test_srcref <- function() {
> > +    ## find the first call (tracing back) which is not in the testthat package, which matches expect_*
> > +    ## and which has parsing info attached
> > +    testthat <- 'testthat'
> > +    nbe <- Find(function(i) {
>
>

> This code would be more clear if you extracted out the anonymous function
>
ok



> and iterated over sys.frames() instead of a vector of integers
>
The trick is that I need to check both sys.calls(i) and sys.frames(i).



> —
> Reply to this email directly or view it on GitHub<https://github.com/hadley/testthat/pull/85/files#r5265749>
> .
>