Skip to content

Commit

Permalink
fix indenting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Aug 16, 2023
1 parent f846e9a commit 48264ee
Show file tree
Hide file tree
Showing 5 changed files with 416 additions and 415 deletions.
123 changes: 62 additions & 61 deletions crates/json-abi/tests/abi_item_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use std::borrow::Cow;
#[test]
fn operation() {
let s = r#"{
"type":"function",
"inputs": [{
"name":"a",
"type":"address"
}],
"name":"foo",
"outputs": [],
"type":"function",
"inputs": [{
"name":"a",
"type":"address"
}],
"name":"foo",
"outputs": [],
"stateMutability": "nonpayable"
}"#;
}"#;

let deserialized: AbiItem<'static> = serde_json::from_str(s).unwrap();

Expand All @@ -45,41 +45,41 @@ fn operation() {
#[test]
fn event_operation_with_tuple_array_input() {
let s = r#"{
"type":"event",
"inputs": [
{
"name":"a",
"type":"address",
"indexed":true
},
{
"components": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"indexed": false,
"internalType": "struct Action[]",
"name": "b",
"type": "tuple[]"
}
],
"name":"E",
"outputs": [],
"anonymous": false
}"#;
"type":"event",
"inputs": [
{
"name":"a",
"type":"address",
"indexed":true
},
{
"components": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"indexed": false,
"internalType": "struct Action[]",
"name": "b",
"type": "tuple[]"
}
],
"name":"E",
"outputs": [],
"anonymous": false
}"#;

let deserialized: AbiItem<'static> = serde_json::from_str(s).unwrap();

Expand Down Expand Up @@ -144,14 +144,14 @@ fn event_operation_with_tuple_array_input() {
// fn test_sanitize_function_name(name: &str, expected: &str) {
// let s = format!(
// r#"{{
// "type":"function",
// "inputs": [{{
// "name":"a",
// "type":"address"
// }}],
// "name":"{}",
// "outputs": []
// }}"#,
// "type":"function",
// "inputs": [{{
// "name":"a",
// "type":"address"
// }}],
// "name":"{}",
// "outputs": []
// }}"#,
// name
// );

Expand All @@ -177,16 +177,16 @@ fn event_operation_with_tuple_array_input() {
// fn test_sanitize_event_name(name: &str, expected: &str) {
// let s = format!(
// r#"{{
// "type":"event",
// "inputs": [{{
// "name":"a",
// "type":"address",
// "indexed":true
// }}],
// "name":"{}",
// "outputs": [],
// "anonymous": false
// }}"#,
// "type":"event",
// "inputs": [{{
// "name":"a",
// "type":"address",
// "indexed":true
// }}],
// "name":"{}",
// "outputs": [],
// "anonymous": false
// }}"#,
// name
// );

Expand All @@ -206,3 +206,4 @@ fn event_operation_with_tuple_array_input() {
// test_sanitize_event_name("()", "");
// test_sanitize_event_name("", "");
// }

114 changes: 57 additions & 57 deletions crates/json-abi/tests/event_param_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use alloy_json_abi::{EventParam, Param};
#[test]
fn event_param_deserialization() {
let s = r#"{
"name": "foo",
"type": "address",
"indexed": true
}"#;
"name": "foo",
"type": "address",
"indexed": true
}"#;

let deserialized: EventParam = serde_json::from_str(s).unwrap();

Expand All @@ -29,26 +29,26 @@ fn event_param_deserialization() {
#[test]
fn event_param_tuple_deserialization() {
let s = r#"{
"name": "foo",
"type": "tuple",
"indexed": true,
"components": [
{
"name": "foo",
"type": "tuple",
"indexed": true,
"components": [
{
"name": "a",
"type": "uint48"
},
{
"type": "uint48"
},
{
"name": "b",
"type": "tuple",
"components": [
{
"type": "tuple",
"components": [
{
"name": "c",
"type": "address"
}
]
}
]
}"#;
"type": "address"
}
]
}
]
}"#;

let deserialized: EventParam = serde_json::from_str(s).unwrap();

Expand Down Expand Up @@ -87,79 +87,79 @@ fn event_param_tuple_deserialization() {
#[test]
fn event_param_tuple_array_deserialization() {
let s = r#"{
"components": [
{
"components": [
{
"type": "uint256",
"name": "a"
},
{
{
"type": "address",
"name": "b"
},
{
"components": [
{
{
"components": [
{
"type": "address",
"name": "c"
},
{
{
"type": "address",
"name": "d"
}
],
"type": "tuple",
],
"type": "tuple",
"name": "e"
},
{
},
{
"type": "uint256",
"name": "f"
},
{
"components": [
{
"components": [
{
{
"components": [
{
"components": [
{
"type": "address",
"name": "g"
},
{
{
"type": "bytes",
"name": "h"
}
],
"type": "tuple[]",
],
"type": "tuple[]",
"name": "i"
},
{
"components": [
{
},
{
"components": [
{
"type": "address",
"name": "j"
},
{
{
"type": "uint256",
"name": "k"
}
],
"type": "tuple[]",
],
"type": "tuple[]",
"name": "l"
},
{
},
{
"type": "uint256",
"name": "m"
}
],
"type": "tuple[]",
],
"type": "tuple[]",
"name": "n"
},
{
},
{
"type": "uint256",
"name": "o"
}
],
"indexed": false,
"name": "LogTaskSubmitted",
"type": "tuple"
],
"indexed": false,
"name": "LogTaskSubmitted",
"type": "tuple"
}"#;

let deserialized: EventParam = serde_json::from_str(s).unwrap();
Expand Down
Loading

0 comments on commit 48264ee

Please sign in to comment.