Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
r2ogs6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
OpenGeoSys Tools
r2ogs6
Commits
63c39670
Commit
63c39670
authored
3 years ago
by
phit0
Browse files
Options
Downloads
Patches
Plain Diff
[test] Helpful error message for new xml tags
parent
8d1b6912
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!38
Draft: standardize files references during prj import/export
,
!35
Resolve "Manual CI job to run all benchmarks"
,
!33
Resolve "Update to OGSv6.4.1"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/read_in_utils.R
+6
-3
6 additions, 3 deletions
R/read_in_utils.R
tests/testthat/test-read_in_utils.R
+15
-0
15 additions, 0 deletions
tests/testthat/test-read_in_utils.R
with
21 additions
and
3 deletions
R/read_in_utils.R
+
6
−
3
View file @
63c39670
...
...
@@ -261,12 +261,15 @@ order_parameters <- function(parameters, class_name){
class_args
<-
get_class_args
(
class_name
)
# cat("\nParameter names not in", class_name, "class arguments:")
# print(names(parameters)[!names(parameters) %in% class_args])
# logical vector of length(parameters) to exclude r2ogs6 specific parameters
standard_parameters
<-
names
(
parameters
)
%in%
c
(
"xpath"
,
"attr_names"
,
"flatten_on_exp"
,
"unwrap_on_exp"
)
#Check for length and value mismatches if class does not have Ellipsis
if
(
!
"..."
%in%
class_args
){
assertthat
::
assert_that
(
length
(
parameters
)
<=
length
(
class_args
))
assertthat
::
assert_that
(
length
(
parameters
[
!
standard_parameters
])
<=
length
(
class_args
))
for
(
i
in
seq_len
(
length
(
parameters
))){
# cat("\n", names(parameters)[[i]], "\n")
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-read_in_utils.R
+
15
−
0
View file @
63c39670
...
...
@@ -66,4 +66,19 @@ test_that("order_parameters works for classes with Ellipsis argument", {
index_values
=
list
(
"1"
,
"1 2"
)))
})
test_that
(
"order_parameters throws a helpful error message for missing
class arguments"
,
{
# e.g. a new process node in a *.prj file is found and the corresponding
# class in prj_process is missing
ogs6_process
<-
prj_pr_property
(
name
=
"test"
,
# use a class that does not have "..."
type
=
"LIQUID_FLOW"
)
# replace one parameter
names
(
ogs6_process
)[
4
]
<-
"Frodos_Ring"
expect_error
(
order_parameters
(
parameters
=
ogs6_process
,
class_name
=
"prj_pr_property"
),
regexp
=
"Frodos_Ring not in class_args of class prj_pr_property"
)
}
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment