mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 15:20:16 +00:00
Fix Display
of Value::LastError
with lambda
There was a small typo in the `fn display_last_error`. Closes #263
This commit is contained in:
parent
dcfa51c756
commit
ec3d3a4e6f
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -127,6 +127,7 @@ dependencies = [
|
||||
"lalrpop",
|
||||
"lalrpop-util",
|
||||
"multimap",
|
||||
"non-empty-vec",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -33,6 +33,7 @@ thiserror = "1.0.23"
|
||||
[dev-dependencies]
|
||||
fstrings = "0.2.3"
|
||||
criterion = "0.3.3"
|
||||
non-empty-vec = { version = "0.2.0" }
|
||||
|
||||
[[bench]]
|
||||
name = "parser"
|
||||
|
@ -152,7 +152,7 @@ fn display_last_error(
|
||||
last_error_accessor: &Option<LambdaAST>,
|
||||
) -> fmt::Result {
|
||||
match last_error_accessor {
|
||||
Some(accessor) => write!(f, "%last_error%.$.{}", air_lambda_ast::format_ast(accessor)),
|
||||
Some(accessor) => write!(f, "%last_error%.${}", air_lambda_ast::format_ast(accessor)),
|
||||
None => write!(f, "%last_error%"),
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ mod instruction_arguments;
|
||||
mod instructions;
|
||||
mod values;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
pub use instruction_arguments::*;
|
||||
pub use instructions::*;
|
||||
pub use values::*;
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2022 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use crate::ast::Value;
|
||||
use air_lambda_ast::ValueAccessor;
|
||||
use non_empty_vec::NonEmpty;
|
||||
|
||||
#[test]
|
||||
// https://github.com/fluencelabs/aquavm/issues/263
|
||||
fn issue_263() {
|
||||
let val = Value::LastError(Some(NonEmpty::new(ValueAccessor::FieldAccessByName {
|
||||
field_name: "message",
|
||||
})));
|
||||
assert_eq!(val.to_string(), "%last_error%.$.message");
|
||||
}
|
17
crates/air-lib/air-parser/src/ast/tests/mod.rs
Normal file
17
crates/air-lib/air-parser/src/ast/tests/mod.rs
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2022 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
pub mod instruction_arguments;
|
Loading…
Reference in New Issue
Block a user