Merge pull request #1559 from ethcore/client-ipc-tests

Enum variants serialisation test&fix
This commit is contained in:
Nikolay Volf 2016-07-07 14:15:46 +04:00 committed by GitHub
commit f023d7a17f
2 changed files with 27 additions and 3 deletions

View File

@ -19,7 +19,7 @@
use nanoipc; use nanoipc;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{Ordering, AtomicBool}; use std::sync::atomic::{Ordering, AtomicBool};
use client::{Client, ClientConfig, RemoteClient}; use client::{Client, BlockChainClient, ClientConfig, RemoteClient, BlockID};
use tests::helpers::*; use tests::helpers::*;
use devtools::*; use devtools::*;
use miner::Miner; use miner::Miner;
@ -55,3 +55,17 @@ fn can_handshake() {
assert!(remote_client.handshake().is_ok()); assert!(remote_client.handshake().is_ok());
}) })
} }
#[test]
fn can_query_block() {
crossbeam::scope(|scope| {
let stop_guard = StopGuard::new();
let socket_path = "ipc:///tmp/parity-client-rpc-20.ipc";
run_test_worker(scope, stop_guard.share(), socket_path);
let remote_client = nanoipc::init_client::<RemoteClient<_>>(socket_path).unwrap();
let non_existant_block = remote_client.block_header(BlockID::Number(999));
assert!(non_existant_block.is_none());
})
}

View File

@ -707,7 +707,12 @@ fn binary_expr_variant(
let buffer = &mut buffer[1..]; let buffer = &mut buffer[1..];
$write_expr $write_expr
}), }),
read: quote_arm!(cx, $variant_index_ident => { $read_expr } ), read: quote_arm!(cx,
$variant_index_ident => {
let buffer = &buffer[1..];
$read_expr
}
),
}) })
}, },
ast::VariantData::Struct(ref fields, _) => { ast::VariantData::Struct(ref fields, _) => {
@ -742,7 +747,12 @@ fn binary_expr_variant(
let buffer = &mut buffer[1..]; let buffer = &mut buffer[1..];
$write_expr $write_expr
}), }),
read: quote_arm!(cx, $variant_index_ident => { $read_expr } ), read: quote_arm!(cx,
$variant_index_ident => {
let buffer = &buffer[1..];
$read_expr
}
),
}) })
}, },
} }