Skip to content

Commit

Permalink
Get slice tests running in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
chinedufn committed Feb 28, 2020
1 parent 6684987 commit fb470be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
15 changes: 0 additions & 15 deletions crates/web-sys/tests/wasm/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,6 @@ export function new_title() {
return document.createElement("title");
}

export function new_webgl_rendering_context() {
const canvas = document.createElement('canvas');
return canvas.getContext('webgl');
}

export function new_webgl2_rendering_context() {
const canvas = document.createElement('canvas');
return canvas.getContext('webgl2');
}

export function new_websocket () {
const websocket = new WebSocket("");
return websocket;
}

export function new_xpath_result() {
let xmlDoc = new DOMParser().parseFromString("<root><value>tomato</value></root>", "application/xml");
let xpathResult = xmlDoc.evaluate("/root//value", xmlDoc, null, XPathResult.ANY_TYPE, null);
Expand Down
23 changes: 3 additions & 20 deletions crates/web-sys/tests/wasm/whitelisted_immutable_slices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,9 @@
//!
//! @see https://github.com/rustwasm/wasm-bindgen/issues/1005
use wasm_bindgen::prelude::*;
use web_sys::{WebGl2RenderingContext, WebGlRenderingContext, WebSocket};
use wasm_bindgen_test::*;

wasm_bindgen_test_configure!(run_in_browser);

#[wasm_bindgen(module = "/tests/wasm/element.js")]
extern "C" {
fn new_webgl_rendering_context() -> WebGlRenderingContext;
fn new_webgl2_rendering_context() -> WebGl2RenderingContext;
fn new_websocket() -> WebSocket;
// TODO: Add a function to create another type to test here.
// These functions come from element.js
}

// Ensure that our whitelisted WebGlRenderingContext methods work
// GECKODRIVER=geckodriver cargo test -p web-sys --target wasm32-unknown-unknown --all-features test_webgl_rendering_context_immutable_slices
#[wasm_bindgen_test]
// Ensure that our whitelisted WebGlRenderingContext methods compile with immutable slices.
fn test_webgl_rendering_context_immutable_slices() {
let gl = new_webgl_rendering_context();

Expand Down Expand Up @@ -70,8 +55,7 @@ fn test_webgl_rendering_context_immutable_slices() {
gl.compressed_tex_image_2d_with_u8_array(0, 0, 0, 0, 0, 0, &[1]);
}

// GECKODRIVER=geckodriver cargo test -p web-sys --target wasm32-unknown-unknown --all-features test_webgl2_rendering_context_immutable_slices
#[wasm_bindgen_test]
// Ensure that our whitelisted WebGl2RenderingContext methods compile with immutable slices.
fn test_webgl2_rendering_context_immutable_slices() {
let gl = new_webgl2_rendering_context();

Expand All @@ -80,8 +64,7 @@ fn test_webgl2_rendering_context_immutable_slices() {
gl.compressed_tex_image_3d_with_u8_array(0, 0, 0, 0, 0, 0, 0, &[1]);
}

// GECKODRIVER=geckodriver cargo test -p web-sys --target wasm32-unknown-unknown --all-features test_websocket_immutable_slices
#[wasm_bindgen_test]
// Ensure that our whitelisted WebSocket methods compile with immutable slices.
fn test_websocket_immutable_slices() {
let ws = new_websocket();
ws.send_with_u8_array(&[0]);
Expand Down

0 comments on commit fb470be

Please sign in to comment.