File: test-libjson-large.R

package info (click to toggle)
r-cran-jsonlite 1.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,304 kB
  • sloc: ansic: 3,789; sh: 9; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 461 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
context("libjson Large strings")

test_that("escaping and parsing of special characters", {
  
  #create random strings
  mychars <- c('a', 'b', " ", '"', "\\", "\t", "\n", "'", "/", "#", "$");
  createstring <- function(length){
    paste(mychars[ceiling(runif(length, 0, length(mychars)))], collapse="")
  }  

  #try some very long strings
  for(i in 1:10){
    zz <- list(foo=createstring(1e5))
    expect_that(zz, equals(fromJSON(toJSON(zz))));
  }
  
});