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 204, Fri Feb 18 16:48:22 2011 UTC
# Line 11  Line 11 
11   verbose=TRUE   verbose=TRUE
12  ### Show output?  ### Show output?
13   ){   ){
   result <- extract.docs.file(f)  
14    e <- new.env()    e <- new.env()
15    sys.source(f,e)    suppressWarnings(sys.source(f,e))
16    ## these are the items to check for, in no particular order    ## these are the items to check for, in no particular order
17    .result <- e$.result    .result <- e$.result
18      result <- extract.docs.file(f,e$.parsers)
19    for(FUN in names(.result)){    for(FUN in names(.result)){
20      if(verbose)cat(FUN,"")      if(verbose)cat(FUN,"")
21      fun <- result[[FUN]]      fun <- result[[FUN]]
# Line 38  Line 38 
38        stop("extracted some unexpected docs!")        stop("extracted some unexpected docs!")
39      }      }
40    }    }
41      ## make sure there are no unexpected outer lists
42      not.expected <- names(result)[!names(result)%in%names(.result)]
43      if(length(not.expected)){
44        print(not.expected)
45        stop("extracted some unexpected documentation objects!")
46      }
47      ## finally make a package using this file and see if it passes
48      ## without warnings
49      if(!is.null(e$.dontcheck))return()
50      pkgname <- sub(".[rR]$","",basename(f))
51      pkgdir <- file.path(tempdir(),pkgname)
52      if(file.exists(pkgdir))unlink(pkgdir,recursive=TRUE)
53      rdir <- file.path(pkgdir,"R")
54      dir.create(rdir,recursive=TRUE)
55      desc <- file.path(system.file(package="inlinedocs"),"silly","DESCRIPTION")
56      file.copy(desc,pkgdir)
57      file.copy(f,rdir)
58      package.skeleton.dx(pkgdir,e$.parsers)
59      cmd <- sprintf("%s CMD check %s",file.path(R.home("bin"), "R"),pkgdir)
60      if(verbose)cat(cmd,"\n")
61      checkLines <- system(cmd,intern=TRUE)
62      warnLines <- grep("WARNING",checkLines,value=TRUE)
63      if(length(warnLines)>0){
64        print(warnLines)
65        stop("WARNING encountered in package check!")
66      }
67    if(verbose)cat("\n")    if(verbose)cat("\n")
68  }  }
69    
70  save.test.result <- function  save.test.result <- function
71  ### For unit tests, this is an easy way of getting a text  ### For unit tests, this is an easy way of getting a text
72  ### 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.204

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