Skip to content

Format all test cases with air for comparison #1256

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
31 changes: 31 additions & 0 deletions inst/air/overwrite-in-test-files-with-out-files.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# List all input files recursively that end with "-in.R"
input_files <- list.files(
path = "tests/testthat",
pattern = "-in\\.R$",
recursive = TRUE,
full.names = TRUE
)

# Function to generate output filename by replacing -in.R with -out.R
get_output_filename <- function(input_file) {
gsub("-in\\.R$", "-out.R", input_file)
}

# Process each file
for (input_file in input_files) {
output_file <- get_output_filename(input_file)

# Create directory for output file if it doesn't exist
output_dir <- dirname(output_file)
if (!dir.exists(output_dir)) {
dir.create(output_dir, recursive = TRUE)
}

# Read input file and write to output file
file.copy(input_file, output_file, overwrite = TRUE)

# Print status
cat(sprintf("Processed: %s -> %s\n", input_file, output_file))
}

cat(sprintf("\nProcessed %d files\n", length(input_files)))
27 changes: 19 additions & 8 deletions tests/testthat/alignment/cols-with-one-row-out.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
c(
"x", "z",
"cgjhg", "thi", "z"
"x",
"z",
"cgjhg",
"thi",
"z"
)


c(
"x", "z",
"cgjhg", "thi", "z"
"x",
"z",
"cgjhg",
"thi",
"z"
)


c(
"x", "y", "z", "m", "n", "o", "p",
"c", "d"
"x",
"y",
"z",
"m",
"n",
"o",
"p",
"c",
"d"
)
39 changes: 14 additions & 25 deletions tests/testthat/alignment/fun-decs-out.R
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
# aligned
function(x = NULL,
tt = NULL,
ayz = NULL) {}

function(x = NULL, tt = NULL, ayz = NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty braces will be fixes as part of posit-dev/air#186

}

# aligned
k <- function(x = NULL,
aq = NULL,
ayz = NULL) {}

k <- function(x = NULL, aq = NULL, ayz = NULL) {
}

# aligned, eq right
function(x = 2,
tt = 1,
ayz = 99) {}
function(x = 2, tt = 1, ayz = 99) {
}

# aligned, eq left
function(x = 2,
tt = 1,
ayz = 99) {}

function(x = 2, tt = 1, ayz = 99) {
}

# not aligned
k <- function(x = fish,
aq = 21,
ayz = t(322)) {}
k <- function(x = fish, aq = 21, ayz = t(322)) {
}

# aligned
k <- function(x = flus(we),
aq = x - 22, k = 22,
ayz = m(jk5), xfea = 3) {}

k <- function(x = flus(we), aq = x - 22, k = 22, ayz = m(jk5), xfea = 3) {
}

# aligned
k <- function(x = flus(we),
aq = x - 22, k = 22,
ayz = m(jk5), xfea = 3) {}
k <- function(x = flus(we), aq = x - 22, k = 22, ayz = m(jk5), xfea = 3) {
}
Loading
Loading