-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1248 from r-lib/use-expect-no-warning
Use `expect_no_warning()`
- Loading branch information
Showing
61 changed files
with
359 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
test_that("curly-culry", { | ||
expect_warning(test_collection("curly-curly", | ||
expect_no_warning(test_collection("curly-curly", | ||
"mixed", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
test_that("does apply spacing rules only if not aligned", { | ||
expect_warning(test_collection("alignment", | ||
expect_no_warning(test_collection("alignment", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
|
||
text <- "tribble(\n ~x, ~y,\n 11, list(a = 1),\n 2, list(bjj = 2)\n)" | ||
expect_warning(style_text(text), NA) | ||
expect_no_warning(style_text(text)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
test_that("reindent function declaration", { | ||
expect_warning(test_collection("fun_dec", "fun_dec_scope_spaces", | ||
expect_no_warning(test_collection("fun_dec", "fun_dec_scope_spaces", | ||
transformer = style_text, scope = "spaces" | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("fun_dec", "line_break_fun_dec", | ||
expect_no_warning(test_collection("fun_dec", "line_break_fun_dec", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
test_that("edge cases work", { | ||
expect_warning(test_collection("indention_fun_calls", | ||
expect_no_warning(test_collection("indention_fun_calls", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
test_that("multiple round brackets don't cause extraindention", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"round_only", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"round_closing_on_same_line", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
test_that("multiple curly brackets don't cause extraindention", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"curly_only", | ||
transformer = style_text_without_curly_curly | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
test_that("multiple curly and round brackets don't cause extraindention", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"curly_and_round", | ||
transformer = style_text_without_curly_curly | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
|
||
test_that("multiple curly and round brackets overall test", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"overall", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("if and ifelse interacting with curly braces works", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"if_else_curly", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("edge cases work", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"edge_strict", | ||
transformer = style_text_without_curly_curly | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("token / braces interaction works", { | ||
expect_warning(test_collection("indention_multiple", | ||
expect_no_warning(test_collection("indention_multiple", | ||
"fun_for_new_line", | ||
transformer = style_text_without_curly_curly | ||
), NA) | ||
)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,155 +1,152 @@ | ||
test_that("pipe is indended correctly", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"pipe", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("base pipe is indended correctly", { | ||
skip_if(getRversion() < "4.1") | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"base_pipe", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("mathematical operators are indended correctly", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"plus_minus", | ||
transformer = style_op | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"multiply_divide", | ||
transformer = style_op | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
test_that("while / for / if without curly brackets", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"while_for_if_without_curly_non_strict", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
expect_warning(test_collection("indention_operators", | ||
)) | ||
expect_no_warning(test_collection("indention_operators", | ||
"while_for_without_curly_same_line_non_strict", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"if-else-no-braces-not-strict", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("function multiline without curly brackets", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"function-multiline-no-braces-strict", | ||
transformer = style_text, strict = TRUE | ||
), NA) | ||
expect_warning(test_collection("indention_operators", | ||
)) | ||
expect_no_warning(test_collection("indention_operators", | ||
"function-multiline-no-braces-non-strict", | ||
transformer = style_text, strict = FALSE | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("while / for / if without curly brackets", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"while_for_if_without_curly_strict", | ||
transformer = style_text, strict = TRUE | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
test_that("nested for and indention", { | ||
expect_warning( | ||
expect_no_warning( | ||
test_collection("indention_operators", | ||
"nested-for-spacing-scope-indention", | ||
transformer = style_text, scope = "indention" | ||
), | ||
NA | ||
) | ||
) | ||
|
||
expect_warning( | ||
expect_no_warning( | ||
test_collection("indention_operators", | ||
"nested-for-spacing-scope-spaces", | ||
transformer = style_text, scope = "spaces" | ||
), | ||
NA | ||
) | ||
) | ||
}) | ||
|
||
test_that("logical, special EQ_SUB and EQ_ASSIGN tokens are indented correctly", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"logical_special", | ||
transformer = style_text, scope = "line_breaks" | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_assign", | ||
transformer = style_text | ||
), NA) | ||
expect_warning(test_collection("indention_operators", | ||
)) | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_formal_simple", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("dollar is indented and spaced correctly", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"dollar", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that( | ||
"code is indented correctly if not first pontial trigger causes indention", | ||
{ | ||
expect_warning( | ||
expect_no_warning( | ||
test_collection( | ||
"indention_operators", "not_first_trigger", | ||
transformer = style_text | ||
), | ||
NA | ||
) | ||
) | ||
} | ||
) | ||
|
||
test_that("indents eq_sub correctly with various levels of scope", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_sub_complex_indention", | ||
transformer = style_text, scope = "indention" | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_sub_complex_tokens", | ||
transformer = style_text, scope = "tokens" | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("indents eq_formals correctly with various levels of scope", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_formals_complex_indention", | ||
transformer = style_text, scope = "indention" | ||
), NA) | ||
)) | ||
|
||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"eq_formals_complex_tokens", | ||
transformer = style_text, scope = "tokens" | ||
), NA) | ||
)) | ||
}) | ||
|
||
test_that("tilde causes indention and is flattened out", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"tilde", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) | ||
|
||
|
||
test_that("overall", { | ||
expect_warning(test_collection("indention_operators", | ||
expect_no_warning(test_collection("indention_operators", | ||
"overall", | ||
transformer = style_text | ||
), NA) | ||
)) | ||
}) |
Oops, something went wrong.