SCM

SCM Repository

[inlinedocs] Diff of /pkg/inlinedocs/R/test.R
ViewVC logotype

Diff of /pkg/inlinedocs/R/test.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138, Tue Oct 19 22:51:59 2010 UTC revision 156, Fri Oct 29 13:06:55 2010 UTC
# Line 13  Line 13 
13   ){   ){
14    result <- extract.docs.file(f)    result <- extract.docs.file(f)
15    e <- new.env()    e <- new.env()
16    sys.source(f,e)    suppressWarnings(sys.source(f,e))
17    ## these are the items to check for, in no particular order    ## these are the items to check for, in no particular order
18    .result <- e$.result    .result <- e$.result
19    for(FUN in names(.result)){    for(FUN in names(.result)){
# Line 38  Line 38 
38        stop("extracted some unexpected docs!")        stop("extracted some unexpected docs!")
39      }      }
40    }    }
41      ## finally make a package using this file and see if it passes
42      ## without warnings
43      if(!is.null(e$.dontcheck))return()
44      pkgname <- sub(".[rR]$","",basename(f))
45      pkgdir <- file.path(tempdir(),pkgname)
46      if(file.exists(pkgdir))unlink(pkgdir,recursive=TRUE)
47      rdir <- file.path(pkgdir,"R")
48      dir.create(rdir,recursive=TRUE)
49      desc <- file.path(system.file(package="inlinedocs"),"silly","DESCRIPTION")
50      file.copy(desc,pkgdir)
51      file.copy(f,rdir)
52      package.skeleton.dx(pkgdir)
53      cmd <- sprintf("%s CMD check %s",file.path(R.home("bin"), "R"),pkgdir)
54      if(verbose)cat(cmd,"\n")
55      checkLines <- system(cmd,intern=TRUE)
56      warnLines <- grep("WARNING",checkLines,value=TRUE)
57      if(length(warnLines)>0){
58        print(warnLines)
59        stop("WARNING encountered in package check!")
60      }
61    if(verbose)cat("\n")    if(verbose)cat("\n")
62  }  }
63    
64  save.test.result <- function  save.test.result <- function
65  ### For unit tests, this is an easy way of getting a text  ### For unit tests, this is an easy way of getting a text
66  ### representation of the list result of extract.docs.file.  ### representation of the list result of extract.docs.file.

Legend:
Removed from v.138  
changed lines
  Added in v.156

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge