-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some additional os information and basic test
- Loading branch information
Showing
5 changed files
with
42 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(osinfo) | ||
|
||
test_check("osinfo") |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
test_that("os_info runs", { | ||
sys_info <- Sys.info() | ||
osinfo <- os_info() | ||
|
||
expect_equal(osinfo$architecture, sys_info[["machine"]]) | ||
# https://docs.rs/os_info/latest/os_info/enum.Type.html | ||
if (sys_info[["sysname"]] == "Darwin") { | ||
expect_true(osinfo$os_type == "Mac OS") | ||
expect_true(osinfo$os == "macos") | ||
} | ||
if (sys_info[["sysname"]] == "linux") { | ||
# this might not hold, but at least on our aws AMI see | ||
# a version of "#18~22.04.1-Ubuntu SMP Wed Jan 10 22:54:16 UTC 2024" | ||
# so the fact that osinfo$os_type is Ubuntu should match | ||
expect_true(grepl(x = sys_info$version, osinfo$os_type, fixed = TRUE)) | ||
expect_true(osinfo$os == "linux") | ||
} | ||
}) |