Skip to content

Commit

Permalink
Merge pull request #271 from r-lib/f-snapshot-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr authored Mar 6, 2021
2 parents 56cc31a + 42040a9 commit 02efcb3
Show file tree
Hide file tree
Showing 44 changed files with 516 additions and 1,558 deletions.
211 changes: 4 additions & 207 deletions tests/testthat/_snaps/ctl_colonnade.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
6 18.1 6 225 105
7 14.3 8 360 245
8 24.4 4 147. 62

---

Code
ctl_colonnade(iris[1:5, ], width = 30)
Output
Expand All @@ -44,9 +41,6 @@
3 4.7 3.2
4 4.6 3.1
5 5 3.6

---

Code
ctl_colonnade(iris[1:3, ], width = 20)
Output
Expand All @@ -55,9 +49,6 @@
1 5.1
2 4.9
3 4.7

---

Code
ctl_colonnade(df_all, width = 30)
Output
Expand All @@ -66,9 +57,6 @@
1 1 1 TRUE a
2 2.5 2 FALSE b
3 NA NA NA <NA>

---

Code
ctl_colonnade(df_all, width = 300)
Output
Expand All @@ -82,9 +70,6 @@
1 <list [2]>
2 <list [1]>
3 <list [1]>

---

Code
options(width = 70)
ctl_colonnade(df_all, width = 300)
Expand All @@ -99,9 +84,6 @@
1 <int [1]> <list [2]>
2 <int [1]> <list [1]>
3 <int [1]> <list [1]>

---

Code
options(width = 60)
ctl_colonnade(df_all, width = 300)
Expand All @@ -116,9 +98,6 @@
1 2015-12-09 10:51:35 <int [1]> <list [2]>
2 2015-12-09 10:51:36 <int [1]> <list [1]>
3 NA <int [1]> <list [1]>

---

Code
options(width = 50)
ctl_colonnade(df_all, width = 300)
Expand All @@ -133,9 +112,6 @@
1 2015-12-09 10:51:35 <int [1]> <list [2]>
2 2015-12-09 10:51:36 <int [1]> <list [1]>
3 NA <int [1]> <list [1]>

---

Code
options(width = 40)
ctl_colonnade(df_all, width = 300)
Expand All @@ -155,9 +131,6 @@
1 <int [1]> <list [2]>
2 <int [1]> <list [1]>
3 <int [1]> <list [1]>

---

Code
options(width = 30)
ctl_colonnade(df_all, width = 300)
Expand All @@ -182,9 +155,6 @@
1 <int [1]> <list [2]>
2 <int [1]> <list [1]>
3 <int [1]> <list [1]>

---

Code
options(width = 20)
ctl_colonnade(df_all, width = 300)
Expand All @@ -204,43 +174,25 @@
1 2015-12-10
2 2015-12-11
3 NA

---

Code
ctl_colonnade(list(
`
` = c("\n",
"\""), `` = factor(
"\n")), width = 30)
ctl_colonnade(list(`
` = c("\n", "\""), `` = factor("\n")), width = 30)
Output
`\n` `\r`
<chr> <fct>
1 "\n" "\n"
2 "\"" "\n"

---

Code
ctl_colonnade(list(
a = c("", " ",
"a ", " a")),
width = 30)
ctl_colonnade(list(a = c("", " ", "a ", " a")), width = 30)
Output
a
<chr>
1 ""
2 " "
3 "a "
4 " a"

---

Code
ctl_colonnade(list(
`mean(x)` = 5,
`var(x)` = 3),
width = 30)
ctl_colonnade(list(`mean(x)` = 5, `var(x)` = 3), width = 30)
Output
`mean(x)` `var(x)`
<dbl> <dbl>
Expand Down Expand Up @@ -269,151 +221,15 @@
1 1
2 2
3 3

---

Code
# dummy

# color, options: UTF-8 is TRUE

Code
style_na("NA")
Output
[1] "\033[31mNA\033[39m"

---

Code
style_neg("-1")
Output
[1] "\033[31m-1\033[39m"

---

Code
xf <- (function() ctl_colonnade(list(x = c((10^(-3:4)) * c(-1, 1), NA))))

---

Code
print(xf())
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle_num = TRUE, print(xf()))
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle = FALSE, print(xf()))
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.neg = FALSE, print(xf()))
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle = FALSE, pillar.neg = FALSE, print(xf()))
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.bold = TRUE, print(xf()))
Output
x
<dbl>
1 -0.001
2 0.01
3 -0.1
4 1
5 -10
6 100
7 -1000
8 10000
9 NA

---

Code
ctl_colonnade(list(a_very_long_column_name = 0), width = 20)
Output
a_very_long_colum…
<dbl>
1 0

# color, options: UTF-8 is FALSE

Code
style_na("NA")
Output
[1] "\033[31mNA\033[39m"

---

Code
style_neg("-1")
Output
Expand All @@ -423,10 +239,6 @@

Code
xf <- (function() ctl_colonnade(list(x = c((10^(-3:4)) * c(-1, 1), NA))))

---

Code
print(xf())
Output
x
Expand All @@ -440,9 +252,6 @@
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle_num = TRUE, print(xf()))
Output
Expand All @@ -457,9 +266,6 @@
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle = FALSE, print(xf()))
Output
Expand All @@ -474,9 +280,6 @@
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.neg = FALSE, print(xf()))
Output
Expand All @@ -491,9 +294,6 @@
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.subtle = FALSE, pillar.neg = FALSE, print(xf()))
Output
Expand All @@ -508,9 +308,6 @@
7 -1000
8 10000
9 NA

---

Code
with_options(pillar.bold = TRUE, print(xf()))
Output
Expand Down
Loading

0 comments on commit 02efcb3

Please sign in to comment.