add conditionals so wasm tests build / run in the right places
This commit is contained in:
parent
5d38faeb40
commit
c284d7364b
|
@ -48,6 +48,7 @@ build_and_test() {
|
||||||
channel build -v --no-default-features --features serde,rustc-serialize
|
channel build -v --no-default-features --features serde,rustc-serialize
|
||||||
TZ=Asia/Katmandu channel test -v --no-default-features --features serde,rustc-serialize --lib
|
TZ=Asia/Katmandu channel test -v --no-default-features --features serde,rustc-serialize --lib
|
||||||
|
|
||||||
|
if [ -n "${TRAVIS}" ]; then
|
||||||
# wasm tests
|
# wasm tests
|
||||||
touch tests/wasm.rs # ensure rebuild happens so TZ / NOW take effect
|
touch tests/wasm.rs # ensure rebuild happens so TZ / NOW take effect
|
||||||
TZ=ACST-9:30 NOW=$(date +%s) wasm-pack test --node
|
TZ=ACST-9:30 NOW=$(date +%s) wasm-pack test --node
|
||||||
|
@ -57,6 +58,7 @@ build_and_test() {
|
||||||
TZ=UTC0 NOW=$(date +%s) wasm-pack test --node
|
TZ=UTC0 NOW=$(date +%s) wasm-pack test --node
|
||||||
touch tests/wasm.rs
|
touch tests/wasm.rs
|
||||||
TZ=Asia/Katmandu NOW=$(date +%s) wasm-pack test --node
|
TZ=Asia/Katmandu NOW=$(date +%s) wasm-pack test --node
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$CHANNEL" == stable ]]; then
|
if [[ "$CHANNEL" == stable ]]; then
|
||||||
if [[ -n "$TRAVIS" ]] ; then
|
if [[ -n "$TRAVIS" ]] ; then
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
extern crate chrono;
|
#[cfg(target_arch = "wasm32")]
|
||||||
extern crate wasm_bindgen_test;
|
mod test {
|
||||||
|
extern crate chrono;
|
||||||
|
extern crate wasm_bindgen_test;
|
||||||
|
|
||||||
use chrono::prelude::*;
|
use self::chrono::prelude::*;
|
||||||
use wasm_bindgen_test::*;
|
use self::wasm_bindgen_test::*;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn now() {
|
fn now() {
|
||||||
let utc: DateTime<Utc> = Utc::now();
|
let utc: DateTime<Utc> = Utc::now();
|
||||||
let local: DateTime<Local> = Local::now();
|
let local: DateTime<Local> = Local::now();
|
||||||
|
|
||||||
|
@ -24,4 +26,5 @@ fn now() {
|
||||||
_ => panic!("unexpected TZ"),
|
_ => panic!("unexpected TZ"),
|
||||||
};
|
};
|
||||||
assert_eq!(&expected_offset, local.offset());
|
assert_eq!(&expected_offset, local.offset());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue