Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pr commands #22

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/testmanual/addins/r-valid.R
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
1+ 1
1 + 1 # tst
# flush
# more
34 changes: 16 additions & 18 deletions tests/testthat/alignment/named-in.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ call(

# algorithm: not aligned (spacing around =). human: aligned (fix: spacing around =).
call(
x =1, kdd = 2,
xy =2, n = 33,
x = 1, kdd = 2,
xy = 2, n = 33,
)

# algorithm: not aligned. human: not aligned.
call(
x = 1, kdd = 2,
x = 1, kdd = 2,
xy = 2, n = 33,
)

# algorithm: not aligned. human: not aligned.
call(
x = 1, kdd = 2,
x = 1, kdd = 2,
xy = 22, n = 33,
)

# algorithm: not aligned. human: not aligned.
call(
x = 1, d = 2,
x = 1, d = 2,
xy = 22, n = 33,
)

Expand All @@ -63,7 +63,6 @@ call(
# algorithm: aligned. human: aligned.
call(
x = 1, n = 33, z = "333",

xy = 2,
)

Expand Down Expand Up @@ -107,8 +106,8 @@ call(
# if all col1 arguments are named, col1 must also be aligned
# not aligned
fell(
x = 1,
y = 23,
x = 1,
y = 23,
zz = NULL
)

Expand All @@ -122,8 +121,8 @@ fell(
# aligned but comma in the wrong line
call(
a = 2,
bb = 3
,)
bb = 3,
)


# aligned (comments)
Expand Down Expand Up @@ -155,15 +154,15 @@ call(

# not aligned (comments)
call(
a = 2, x = 111,
bb = 3, # hi
a = 2, x = 111,
bb = 3, # hi
)

# not aligned (comments)
call(
# another one
a = 2, x = 111,
bb = 3,
a = 2, x = 111,
bb = 3,
# hi
)

Expand All @@ -173,8 +172,7 @@ call(
# the extra spaces before `=` as of 29a010064257fa1a9caf32d182e7ee62008de98a.
call(
x = 95232,
y = f(
),
y = f(),
)


Expand All @@ -187,9 +185,9 @@ ca(

# not aligned (left after `=`)
ca(
x = 23200,
x = 23200,
y2 = "hi",
m = c(rm.na = 7)
m = c(rm.na = 7)
)

# aligned =, first all named
Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/alignment/tribble-in.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ tribble(
)

tribble(
~x, ~d,
~x, ~d,
"axa'fa", 1:6,
"b", 4:6
"b", 4:6
)


tribble(
~x, ~d,
~x, ~d,
"axa'fa", 1:6,
"b", 4:6
"b", 4:6
)

tribble(
~x, ~d,
"axa'fa", 1:6,
"b", 4:6
~x, ~d,
"axa'fa", 1:6,
"b", 4:6
)

# has EQ_SUB which don't match, not tribble-like
Expand Down
92 changes: 46 additions & 46 deletions tests/testthat/curly-curly/mixed-in.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,17 @@
call({{ x }})

# removing line breaks
call({{
x
}})
call({{ x }})

call({
{x
}})
call({{ x }})

call({
{x}}
)
call({{ x }})

call({
{x}
})
call({{ x }})

call(
{
{x
}
}
)
{{ x }}
)

## ............................................................................
## spaces ####
Expand All @@ -35,33 +24,37 @@ call(
call({{ x }})

# removing spaces between braces
call({ { x }})
call({ { x }} )
call( { { x }})
call( { { x } })
call({{ x }})
call({{ x }})
call({{ x }})
call({{ x }})

# inserting spaces within {{
call({{x }})
call({{x}})
call({{ x}})
call({{ x }})
call({{ x }})
call({{ x }})

# not removing spaces within {{
call({{ x }})


# combine spaces and line breaks
call({{ x}
})
call({{ x }})

call({
{ x}})
call({{ x }})

# not applicable when only one curly brace
{
y
}
{ 1 + 1}
{{1 + a} + 1} # not curly-culry!
{
1 + 1
}
{
{
1 + a
} + 1
} # not curly-culry!


## ............................................................................
Expand All @@ -71,30 +64,37 @@ call("test", {
})

call(
"test", {
1
})

call("test",
{
"test",
{
1
})
}
)

call("test", {
1 }
)
1
})

call({
call("test", {
1
}, a + b, { 33 / f(c)})
})

call(
{
1
},
a + b,
{
33 / f(c)
}
)

call({{ x }}, {{ y}})
call({{ x }}, {{ y}
})
call({{ x }}, {{ y }})
call({{ x }}, {{ y }})
call(
{{ x }}, {{ y}})
{{ x }}, {{ y }}
)

call(
{{ x }},
{{ y}} := 3, f(bk)
{{ y }} := 3, f(bk)
)
8 changes: 3 additions & 5 deletions tests/testthat/fun_dec/fun_dec_scope_spaces-in.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
a <- function(x, #
y
) {
y) {
x - 1
}


a <- function(x, #
y) #
y) #
{
x
}
Expand All @@ -23,5 +22,4 @@ function(a =

function(a =
b,
c
) {}
c) {}
8 changes: 3 additions & 5 deletions tests/testthat/fun_dec/fun_dec_scope_spaces-out.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
a <- function(x, #
y
) {
y) {
x - 1
}


a <- function(x, #
y) #
y) #
{
x
}
Expand All @@ -23,5 +22,4 @@ function(a =

function(a =
b,
c
) {}
c) {}
8 changes: 3 additions & 5 deletions tests/testthat/fun_dec/line_break_fun_dec-in.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ a <- function(x,
}

a <- function(x,

y) {
x - 1
}


a <- function(
x,
a <- function(x,
y) {
x - 1
}

a <- function( #
x,
y) {
x,
y) {
x - 1
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
{1 + 3}
{2 + sin(pi)}
}
{{
1 + 3
}
{
2 + sin(pi)
}}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
{
1 + 3
}
{
2 + sin(pi)
}
{{
1 + 3
}
{
2 + sin(pi)
}}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
a <- function(x) {
x <- c(1,
2 + 3,
sin(pi))
x <- c(
1,
2 + 3,
sin(pi)
)

if(x > 10) {
if (x > 10) {
return("done")
}
}
}
}
Loading