fallout from repo split

This commit is contained in:
Naja Melan
2019-07-17 20:38:40 +02:00
parent 354372b3c0
commit 18dfd3cfb6
5 changed files with 97 additions and 46 deletions

View File

@@ -1,9 +1,7 @@
# Auto-generated from "Cargo.yml"
[dependencies]
console_log = "^0.1"
failure = "^0.1"
log = "^0.4"
wasm-logger = "^0.1"
[dependencies.futures-preview]
default-features = false
@@ -21,11 +19,6 @@ version = "^0.3"
default-features = false
version = "^0.2"
[dependencies.tokio]
default-features = false
features = ["codec"]
version = "^0.1"
[dependencies.wasm-bindgen]
version = "^0.2"
@@ -36,6 +29,7 @@ version = "^0.3"
[dev-dependencies]
bytes = "^0.4"
console_error_panic_hook = "^0.1"
console_log = "^0.1"
flexi_logger = "^0.11"
pretty_assertions = "^0.6"
rand = "^0.6"
@@ -43,6 +37,7 @@ rand_xoshiro = "^0.1"
serde_cbor = "0.9.0"
tokio-serde-cbor = "0.3.1"
wasm-bindgen-test = "^0.2"
wasm-logger = "^0.1"
[dev-dependencies.futures_codec]
path = "../futures-codec"
@@ -51,6 +46,11 @@ path = "../futures-codec"
features = ["derive"]
version = "1.0.87"
[dev-dependencies.tokio]
default-features = false
features = ["codec"]
version = "^0.1"
[package]
authors = ["Naja Melan <najamelan@autistici.org>"]
categories = ["api-bindings", "wasm", "web-programming", "web-programming::websocket"]

View File

@@ -17,8 +17,6 @@ package:
dependencies:
naja_async_runtime : { version: ^0.2, default-features: false }
wasm-logger : ^0.1
console_log : ^0.1
failure : ^0.1
futures-preview : { path: ../futures-rs/futures, features: [std, io-compat, compat], default-features: false }
# futures-preview : { version: =0.3.0-alpha.17, features: [io-compat, compat] }
@@ -27,7 +25,6 @@ dependencies:
js-sys : { version: ^0.3 }
wasm-bindgen : { version: ^0.2 }
tokio : { version: ^0.1, default-features: false, features: [codec] }
web-sys:
version : ^0.3
@@ -42,6 +39,9 @@ dependencies:
dev-dependencies:
tokio : { version: ^0.1, default-features: false, features: [codec] }
wasm-logger : ^0.1
console_log : ^0.1
console_error_panic_hook: ^0.1
pretty_assertions: ^0.6
rand_xoshiro : ^0.1

View File

@@ -8,6 +8,7 @@
## Testing
- verify all features are tested
- enable travis CI
## Documentation
- chat client example

View File

@@ -14,7 +14,7 @@ use
const URL_WSSTREAM: &str = "ws://127.0.0.1:3212/";
const URL_WS : &str = "ws://127.0.0.1:3312/";
const URL_TT : &str = "ws://127.0.0.1:3312/";
@@ -30,7 +30,7 @@ pub fn round_trip_text() -> impl Future01<Item = (), Error = JsValue>
async
{
let (_ws, wsio) = WsStream::connect( URL_WS, None ).await.expect_throw( "Could not create websocket" );
let (_ws, wsio) = WsStream::connect( URL_TT, None ).await.expect_throw( "Could not create websocket" );
let (mut tx, mut rx) = wsio.split();
@@ -90,31 +90,3 @@ pub fn round_trip_binary() -> impl Future01<Item = (), Error = JsValue>
}.boxed_local().compat()
}
// Verify url method.
//
#[ wasm_bindgen_test(async) ]
//
pub fn url() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
info!( "starting test: url" );
async
{
let (ws, _wsio) = WsStream::connect( URL_WSSTREAM, None ).await.expect_throw( "Could not create websocket" );
assert_eq!( URL_WSSTREAM, ws.url() );
let r: Result<(), wasm_bindgen::JsValue> = Ok(());
r
}.boxed_local().compat()
}

View File

@@ -13,8 +13,7 @@ use
};
const URL_WSSTREAM: &str = "ws://127.0.0.1:3212/";
const URL_WS : &str = "ws://127.0.0.1:3312/";
const URL: &str = "ws://127.0.0.1:3212/";
@@ -27,11 +26,11 @@ pub fn state() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
info!( "starting test: state" );
console_log!( "starting test: state" );
async
{
let (ws, wsio) = WsStream::connect( URL_WS, None ).await.expect_throw( "Could not create websocket" );
let (ws, wsio) = WsStream::connect( URL, None ).await.expect_throw( "Could not create websocket" );
assert_eq!( WsState::Open, ws .ready_state() );
assert_eq!( WsState::Open, wsio.ready_state() );
@@ -57,11 +56,11 @@ pub fn close_from_wsio() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
info!( "starting test: state" );
console_log!( "starting test: close_from_wsio" );
async
{
let (ws, mut wsio) = WsStream::connect( URL_WS, None ).await.expect_throw( "Could not create websocket" );
let (ws, mut wsio) = WsStream::connect( URL, None ).await.expect_throw( "Could not create websocket" );
assert_eq!( WsState::Open, ws.ready_state() );
@@ -77,3 +76,82 @@ pub fn close_from_wsio() -> impl Future01<Item = (), Error = JsValue>
}.boxed_local().compat()
}
// Verify url method.
//
#[ wasm_bindgen_test(async) ]
//
pub fn url() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
console_log!( "starting test: url" );
async
{
let (ws, _wsio) = WsStream::connect( URL, None ).await.expect_throw( "Could not create websocket" );
assert_eq!( URL, ws.url() );
let r: Result<(), wasm_bindgen::JsValue> = Ok(());
r
}.boxed_local().compat()
}
// Verify protocols.
//
#[ wasm_bindgen_test(async) ]
//
pub fn no_protocols() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
console_log!( "starting test: no_protocols" );
async
{
let (ws, _wsio) = WsStream::connect( URL, None ).await.expect_throw( "Could not create websocket" );
assert_eq!( "", ws.protocol() );
let r: Result<(), wasm_bindgen::JsValue> = Ok(());
r
}.boxed_local().compat()
}
/*
// Verify protocols.
// This doesn't work with tungstenite for the moment.
//
#[ wasm_bindgen_test(async) ]
//
pub fn protocols_server_accept_none() -> impl Future01<Item = (), Error = JsValue>
{
let _ = console_log::init_with_level( Level::Trace );
console_log!( "starting test: protocols_server_accept_none" );
async
{
let (ws, _wsio) = WsStream::connect( URL, vec![ "chat" ] ).await.expect_throw( "Could not create websocket" );
assert_eq!( "", ws.protocol() );
let r: Result<(), wasm_bindgen::JsValue> = Ok(());
r
}.boxed_local().compat()
}
*/