Fix wasm-pack test, disable test_forward/systex.

(cherry picked from commit 155b3cee4c499187c5a49551e1d50f59cb6e12fe)
This commit is contained in:
MaulingMonkey 2019-09-01 14:29:37 -07:00 коммит произвёл Patrick Reisert
Родитель 232f062228
Коммит 3a4f404ed5
5 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -55,3 +55,6 @@ web-sys = { version = "0.3", features = [
"MidiPort",
"MidiPortType"
]}
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.2"

Просмотреть файл

@ -12,6 +12,7 @@ fn main() {
}
}
#[cfg(not(target_arch = "wasm32"))] // conn_out is not `Send` in Web MIDI, which means it cannot be passed to connect
fn run() -> Result<(), Box<Error>> {
let mut input = String::new();
@ -61,4 +62,10 @@ fn run() -> Result<(), Box<Error>> {
println!("Closing connections");
Ok(())
}
}
#[cfg(target_arch = "wasm32")]
fn run() -> Result<(), Box<Error>> {
println!("test_forward cannot run on Web MIDI");
Ok(())
}

Просмотреть файл

@ -7,7 +7,7 @@ fn main() {
}
}
#[cfg(not(windows))] // virtual ports are not supported on Windows
#[cfg(not(any(windows, target_arch = "wasm32")))] // virtual ports are not supported on Windows nor on Web MIDI
mod example {
use std::thread::sleep;
@ -73,7 +73,7 @@ pub fn run() -> Result<(), Box<Error>> {
}
// needed to compile successfully
#[cfg(windows)] mod example {
#[cfg(any(windows, target_arch = "wasm32"))] mod example {
use std::error::Error;
pub fn run() -> Result<(), Box<Error>> { Ok(()) }
}

Просмотреть файл

@ -238,11 +238,13 @@ mod tests {
fn test_trait_impls() {
// make sure that all the structs implement `Send`
fn is_send<T: Send>() {}
is_send::<MidiInputPort>();
is_send::<MidiInput>();
is_send::<MidiInputConnection<()>>();
is_send::<MidiOutputPort>();
is_send::<MidiOutput>();
is_send::<MidiOutputConnection>();
#[cfg(not(target_arch = "wasm32"))] {
is_send::<MidiInputPort>();
is_send::<MidiInputConnection<()>>();
is_send::<MidiOutputPort>();
is_send::<MidiOutputConnection>();
}
}
}

Просмотреть файл

@ -1,5 +1,5 @@
//! This file contains automated tests, but they require virtual ports and therefore can't work on Windows ...
#![cfg(not(windows))]
//! This file contains automated tests, but they require virtual ports and therefore can't work on Windows or Web MIDI ...
#![cfg(not(any(windows, target_arch = "wasm32")))]
extern crate midir;
use std::thread::sleep;