Add Emscripten build in Travis
This commit is contained in:
parent
d23a40c1bb
commit
d0464fbff7
@ -18,5 +18,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: CLIPPY=true
|
env: CLIPPY=true
|
||||||
|
- rust: nightly
|
||||||
|
env: EMSCRIPTEN=true
|
||||||
|
|
||||||
script: ./travis.sh
|
script: ./travis.sh
|
||||||
|
@ -156,8 +156,12 @@ macro_rules! declare_tests {
|
|||||||
)+
|
)+
|
||||||
};
|
};
|
||||||
|
|
||||||
($($name:ident { $($value:expr => $tokens:expr,)+ })+) => {
|
($(
|
||||||
|
$(#[$cfg:meta])*
|
||||||
|
$name:ident { $($value:expr => $tokens:expr,)+ }
|
||||||
|
)+) => {
|
||||||
$(
|
$(
|
||||||
|
$(#[$cfg])*
|
||||||
#[test]
|
#[test]
|
||||||
fn $name() {
|
fn $name() {
|
||||||
$(
|
$(
|
||||||
@ -260,6 +264,7 @@ declare_tests! {
|
|||||||
0f32 => &[Token::F32(0.)],
|
0f32 => &[Token::F32(0.)],
|
||||||
0f64 => &[Token::F64(0.)],
|
0f64 => &[Token::F64(0.)],
|
||||||
}
|
}
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
test_small_int_to_128 {
|
test_small_int_to_128 {
|
||||||
1i128 => &[Token::I8(1)],
|
1i128 => &[Token::I8(1)],
|
||||||
1i128 => &[Token::I16(1)],
|
1i128 => &[Token::I16(1)],
|
||||||
|
@ -618,6 +618,7 @@ fn test_enum_skipped() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_integer128() {
|
fn test_integer128() {
|
||||||
assert_ser_tokens_error(&1i128, &[], "i128 is not supported");
|
assert_ser_tokens_error(&1i128, &[], "i128 is not supported");
|
||||||
|
@ -26,6 +26,7 @@ fn test_u32_to_enum() {
|
|||||||
assert_eq!(E::B, e);
|
assert_eq!(E::B, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_integer128() {
|
fn test_integer128() {
|
||||||
let de_u128 = IntoDeserializer::<value::Error>::into_deserializer(1u128);
|
let de_u128 = IntoDeserializer::<value::Error>::into_deserializer(1u128);
|
||||||
|
16
travis.sh
16
travis.sh
@ -42,6 +42,22 @@ if [ -n "${CLIPPY}" ]; then
|
|||||||
|
|
||||||
cd "$DIR/test_suite/no_std"
|
cd "$DIR/test_suite/no_std"
|
||||||
cargo clippy -- -Dclippy
|
cargo clippy -- -Dclippy
|
||||||
|
elif [ -n "${EMSCRIPTEN}" ]; then
|
||||||
|
CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest)
|
||||||
|
CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
|
||||||
|
CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz"
|
||||||
|
|
||||||
|
mkdir -p ~/.cargo/bin
|
||||||
|
echo "Downloading cargo-web from: ${CARGO_WEB_URL}"
|
||||||
|
curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web
|
||||||
|
chmod +x ~/.cargo/bin/cargo-web
|
||||||
|
|
||||||
|
# Install Node.js
|
||||||
|
nvm install 9
|
||||||
|
|
||||||
|
cd "$DIR/test_suite"
|
||||||
|
cargo web test --target=asmjs-unknown-emscripten --nodejs
|
||||||
|
cargo web test --target=wasm32-unknown-emscripten --nodejs
|
||||||
else
|
else
|
||||||
CHANNEL=nightly
|
CHANNEL=nightly
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user