inst/unittests/test.strings.r

.setUp <- function() {}
.tearDown <- function() {}

test.strings <- function()
{
	json <- "\"\""
	x <- fromJSON( json )
	checkIdentical( x, "" )

	json <- "\"hello world\""
	x <- fromJSON( json )
	checkIdentical( x, "hello world" )

	json <- "\"hello\\ttab\""
	x <- fromJSON( json )
	checkIdentical( x, "hello\ttab" )

	json <- "\"hello\\\"quote\""
	x <- fromJSON( json )
	checkIdentical( x, "hello\"quote" )

	#really long string
	s <- paste( 1:100000, collapse = "-" )
	json <- paste("\"", s, "\"", sep="" )
	x <- fromJSON( json )
	checkIdentical( x, s )
}

Try the rjson package in your browser

Any scripts or data that you put into this service are public.

rjson documentation built on Sept. 30, 2024, 9:43 a.m.