forked from rustwasm/wasm-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! When generating our web_sys APIs we default to setting slice references that | ||
//! get passed to JS as mutable in case they get mutated in JS. | ||
//! | ||
//! In certain cases we know for sure that the slice will not get mutated - for | ||
//! example when working with the WebGlRenderingContext APIs. | ||
//! | ||
//! These tests ensure that whitelisted methods do indeed accept mutable slices. | ||
//! | ||
//! @see https://github.com/rustwasm/wasm-bindgen/issues/1005 | ||
use wasm_bindgen::prelude::*; | ||
use wasm_bindgen_test::*; | ||
use web_sys::WebGlRenderingContext; | ||
|
||
#[wasm_bindgen(module = "./tests/wasm/element.js")] | ||
extern "C" { | ||
fn new_webgl_rendering_context() -> WebGlRenderingContext; | ||
} | ||
|
||
// Ensure that our whitelisted WebGlRenderingContext methods work | ||
#[wasm_bindgen_test] | ||
fn test_webgl_rendering_context_immutable_slices() { | ||
let gl = new_webgl_rendering_context(); | ||
|
||
gl.vertex_attrib1fv_with_f32_array(0, &[5000.]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
// intentionally left blank | ||
|
||
// QUESTION FOR REVIEWER: WHY? (I'll include this context in the comment) |