File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ context(" format" )
2+
3+ expect_format_equal <- function (formatted , result ) {
4+ expect_equal(
5+ paste(formatted , collapse = " \n " ),
6+ paste(result , collapse = " \n " )
7+ )
8+ }
9+
10+ test_that(" unequal sizes" , {
11+ x <- blob(raw(2 ** 2 ), raw(2 ** 11 ), raw(2 ** 20 ))
12+
13+ expect_format_equal(
14+ format(x ),
15+ c(
16+ " blob[4 B]" ,
17+ " blob[2,050 B]" ,
18+ " blob[1,050,000 B]"
19+ )
20+ )
21+
22+ expect_format_equal(
23+ format(x , trim = FALSE ),
24+ c(
25+ " blob[ 4 B]" ,
26+ " blob[ 2,050 B]" ,
27+ " blob[1,050,000 B]"
28+ )
29+ )
30+ })
31+
32+ test_that(" similar sizes" , {
33+ x <- blob(raw(2 ** 10 ), raw(2 ** 11 ), raw(2 ** 12 ))
34+
35+ expect_format_equal(
36+ format(x ),
37+ c(
38+ " blob[1 kb]" ,
39+ " blob[2 kb]" ,
40+ " blob[4 kb]"
41+ )
42+ )
43+ })
You can’t perform that action at this time.
0 commit comments