Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Review comments
  • Loading branch information
pmikolajczyk41 committed Feb 8, 2023
commit e289ded84dafbefeadb70a2be4740bcaed1765a0
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Support custom environment in e2e tests - [#1645](https://github.com/paritytech/ink/pull/1645)
- Support custom environment in E2E tests - [#1645](https://github.com/paritytech/ink/pull/1645)

### Changed
- E2E: spawn a separate contracts node instance per test ‒ [#1642](https://github.com/paritytech/ink/pull/1642)
Expand Down
16 changes: 8 additions & 8 deletions crates/e2e/macro/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct E2EConfig {
whitelisted_attributes: WhitelistedAttributes,
/// Additional contracts that have to be built before executing the test.
additional_contracts: Vec<String>,
/// Custom environment for the contracts, if specified.
/// Custom environment for the contracts, if specified. Otherwise `DefaultEnvironment` is used.
environment: Option<Path>,
}

Expand All @@ -50,27 +50,27 @@ impl TryFrom<ast::AttributeArgs> for E2EConfig {
ast,
arg,
"additional_contracts",
"e2e test",
"E2E test",
))
}
if let ast::PathOrLit::Lit(syn::Lit::Str(lit_str)) = &arg.value {
additional_contracts = Some((lit_str.clone(), arg))
} else {
return Err(format_err_spanned!(
arg,
"expected a string literal for `additional_contracts` ink! e2e test configuration argument",
"expected a string literal for `additional_contracts` ink! E2E test configuration argument",
))
}
} else if arg.name.is_ident("environment") {
if let Some((_, ast)) = environment {
return Err(duplicate_config_err(ast, arg, "environment", "e2e test"))
return Err(duplicate_config_err(ast, arg, "environment", "E2E test"))
}
if let ast::PathOrLit::Path(path) = &arg.value {
environment = Some((path.clone(), arg))
} else {
return Err(format_err_spanned!(
arg,
"expected a path for `environment` ink! e2e test configuration argument",
"expected a path for `environment` ink! E2E test configuration argument",
))
}
} else {
Expand Down Expand Up @@ -144,7 +144,7 @@ mod tests {
additional_contracts = "adder/Cargo.toml",
},
Err(
"encountered duplicate ink! e2e test `additional_contracts` configuration argument",
"encountered duplicate ink! E2E test `additional_contracts` configuration argument",
),
);
}
Expand All @@ -157,7 +157,7 @@ mod tests {
environment = crate::CustomEnvironment,
},
Err(
"encountered duplicate ink! e2e test `environment` configuration argument",
"encountered duplicate ink! E2E test `environment` configuration argument",
),
);
}
Expand All @@ -168,7 +168,7 @@ mod tests {
syn::parse_quote! {
environment = "crate::CustomEnvironment",
},
Err("expected a path for `environment` ink! e2e test configuration argument"),
Err("expected a path for `environment` ink! E2E test configuration argument"),
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-environment/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `call-runtime` example
# `custom-environment` example

## What is this example about?

Expand Down