repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/slice.rs | tests/wasm/slice.rs | #![cfg(test)]
use paste::paste;
use std::mem::MaybeUninit;
use wasm_bindgen::prelude::*;
use wasm_bindgen::Clamped;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/slice.js")]
extern "C" {
fn js_export();
fn js_import();
fn js_pass_array();
fn js_export_mut();
fn js_return_vec();... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/js_vec.rs | tests/wasm/js_vec.rs | use js_sys::Number;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen_test::wasm_bindgen_test;
#[wasm_bindgen(module = "tests/wasm/js_vec.js")]
extern "C" {
fn pass_array_with_allocation();
}
#[wasm_bindgen]
pub fn test_sum(param: Vec<Number>) -> f64 {
let mut sum = 0.;
for data in param {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/ignore.rs | tests/wasm/ignore.rs | use wasm_bindgen_test::wasm_bindgen_test;
#[wasm_bindgen_test]
#[ignore]
fn should_panic() {
panic!()
}
#[wasm_bindgen_test]
#[ignore = "reason"]
fn should_panic_string() {
panic!()
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/js_namespace_exports.rs | tests/wasm/js_namespace_exports.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(js_namespace = api)]
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
#[wasm_bindgen(js_namespace = api)]
pub fn multiply(a: i32, b: i32) -> i32 {
a * b
}
#[wasm_bindgen(js_namespace = ["utils", "math"])]
pub fn divide(a: f64, b: f64) -> f64 {... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/node.rs | tests/wasm/node.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/node.js")]
extern "C" {
fn test_works();
#[wasm_bindgen(thread_local_v2)]
static FOO: JsValue;
fn hit();
}
#[wasm_bindgen_test]
fn works() {
hit();
assert_eq!(FOO.with(JsValue::as_f64), Some(1.0));
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/imports.rs | tests/wasm/imports.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/imports.js")]
extern "C" {
fn test_simple();
fn simple_foo(s: &str);
fn simple_another(a: u32) -> i32;
fn simple_take_and_return_bool(a: bool) -> bool;
fn simple_return_object() -> JsValue;
#[allow(dead... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/import_class.rs | tests/wasm/import_class.rs | //! dox
#![deny(missing_docs)] // test that documenting public bindings is enough
#![allow(clippy::redundant_clone)] // test specifically with cloned objects
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/import_class.js")]
extern "C" {
fn math_log(f: f64) -> f64;
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/enum_vecs.rs | tests/wasm/enum_vecs.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/enum_vecs.js")]
extern "C" {
fn pass_enum_vec();
fn pass_invalid_enum_vec();
}
#[wasm_bindgen]
pub enum EnumArrayElement {
Unit,
}
#[wasm_bindgen]
pub fn consume_enum_vec(mut vec: Vec<EnumArrayElement>) -> Vec<Enu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/gc.rs | tests/wasm/gc.rs | use js_sys::Promise;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/gc.js")]
extern "C" {
fn drop_callback();
async fn owned_methods();
async fn gc_builder();
async fn gc_constructor();
async fn no_gc_fn_argument();
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/slice_jsvalue.rs | tests/wasm/slice_jsvalue.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/slice_jsvalue.js")]
extern "C" {
fn js_receive_slice(values: &[JsValue]) -> u32;
fn js_receive_slice_and_sum(values: &[JsValue]) -> f64;
fn js_verify_slice_values(values: &[JsValue]) -> bool;
}
#[wasm_bindgen_test]... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/futures.rs | tests/wasm/futures.rs | use js_sys::JsString;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[rustfmt::skip]
#[wasm_bindgen(module = "tests/wasm/futures.js")]
extern "C" {
#[wasm_bindgen(catch)]
async fn call_exports() -> Result<JsValue, JsValue>;
async fn call_promise() -> JsValue;
#[wasm_bindgen(js_name = call_pr... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/async_vecs.rs | tests/wasm/async_vecs.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/async_vecs.js")]
extern "C" {
async fn js_works();
}
#[wasm_bindgen]
extern "C" {
pub type RegExp;
#[wasm_bindgen(constructor)]
fn new(re: &str) -> RegExp;
}
#[wasm_bindgen]
pub async fn async_number_vec() -> ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/result_jserror.rs | tests/wasm/result_jserror.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen::JsError;
use wasm_bindgen_test::*;
use std::fmt;
#[derive(Clone, Debug)]
enum MyError {
Variant,
InflightShouldBeFalse,
}
// shouldn't technically need this, surely
impl std::error::Error for MyError {}
impl fmt::Display for MyError {
fn fmt(&self, f: &mut f... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/getters_and_setters.rs | tests/wasm/getters_and_setters.rs | use std::cell::Cell;
use std::rc::Rc;
use std::sync::atomic::{AtomicU32, Ordering};
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/getters_and_setters.js")]
extern "C" {
fn _1_js(rules: Rules) -> Rules;
fn _2_js(rules: Rules) -> Rules;
fn _3_js(rules: Rules) -> ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/comments.rs | tests/wasm/comments.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/comments.js")]
extern "C" {
fn assert_comments_exist();
}
/// annotated function ✔️ " \ ' {
#[wasm_bindgen]
pub fn annotated() -> String {
String::new()
}
/// annotated struct type
#[wasm_bindgen]
pub struct Annotated... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/bigint.rs | tests/wasm/bigint.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/bigint.js")]
extern "C" {
fn i64_js_identity(a: i64) -> i64;
fn u64_js_identity(a: u64) -> u64;
fn js_works();
}
#[wasm_bindgen]
pub fn zero() -> u64 {
0
}
#[wasm_bindgen]
pub fn one() -> u64 {
1
}
#[wasm... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/vendor_prefix.rs | tests/wasm/vendor_prefix.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/vendor_prefix.js")]
extern "C" {
fn import_me(x: &str);
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(vendor_prefix = webkit)]
type MySpecialApi;
#[wasm_bindgen(constructor)]
fn new() -> MySpecialApi;
#... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/math.rs | tests/wasm/math.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/math.js")]
extern "C" {
fn js_auto_bind_math();
// There's an identity function called `roundtrip` in the module and we bind
// that one function with multiple different signatures here. Note that the
// return... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/char.rs | tests/wasm/char.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/char.js")]
extern "C" {
fn js_identity(c: char) -> char;
fn js_works();
}
#[wasm_bindgen]
pub fn rust_identity(c: char) -> char {
c
}
#[wasm_bindgen]
pub fn rust_option_identity(c: Option<char>) -> Option<char> {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/no_shims.rs | tests/wasm/no_shims.rs | //! A collection of tests to exercise imports where we don't need to generate a
//! JS shim to convert arguments/returns even when Web IDL bindings is not
//! implemented.
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(inline_js = "
function assert_eq(a, b) {
if (a !== b) {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/arg_names.rs | tests/wasm/arg_names.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/arg_names.js")]
extern "C" {
fn js_arg_names();
}
#[wasm_bindgen]
pub fn fn_with_many_args(_a: i32, _b: i32, _c: i32, _d: i32) {}
#[wasm_bindgen_test]
fn rust_arg_names() {
js_arg_names();
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/reexport.rs | tests/wasm/reexport.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(reexport, js_name = "console")]
pub type Console;
#[wasm_bindgen(method)]
fn log(this: &Console, s: &str);
}
#[wasm_bindgen(module = "tests/wasm/reexport.js")]
extern "C" {
#[wasm_bindgen(thread_lo... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/string_vecs.rs | tests/wasm/string_vecs.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/string_vecs.js")]
extern "C" {
fn pass_string_vec();
fn pass_invalid_string_vec();
}
#[wasm_bindgen]
pub fn consume_string_vec(mut vec: Vec<String>) -> Vec<String> {
vec.push("Hello from Rust!".to_owned());
vec... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/link_to.rs | tests/wasm/link_to.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "/tests/wasm/link_to.js")]
extern "C" {
#[wasm_bindgen(catch)]
fn read_file(url: &str) -> Result<String, JsValue>;
}
#[wasm_bindgen_test]
fn test_module() {
let link = wasm_bindgen::link_to!(module = "/tests/wasm/linked_module... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/js_keywords.rs | tests/wasm/js_keywords.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/js_keywords.js")]
extern "C" {
fn js_keywords_compile();
fn test_keyword_1_as_fn_name(x: u8) -> u8;
fn test_keyword_2_as_fn_name(x: u8, y: u8) -> bool;
fn test_keyword_as_fn_arg(x: u8) -> u8;
}
#[wasm_bindgen]
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/classes.rs | tests/wasm/classes.rs | #[allow(unused_imports)] // test for #919
use std::borrow::BorrowMut;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/classes.js")]
extern "C" {
fn js_simple();
fn js_strings();
fn js_exceptions(is_panic_unwind: bool);
fn js_pass_one_to_another();
fn tak... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/try_from_js_value.rs | tests/wasm/try_from_js_value.rs | use wasm_bindgen::convert::TryFromJsValue;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/try_from_js_value.js")]
extern "C" {
type TryFromJsValueCustomType;
#[wasm_bindgen(constructor)]
fn new() -> TryFromJsValueCustomType;
#[wasm_bindgen(method)]
fn ge... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/closures.rs | tests/wasm/closures.rs | use js_sys::Number;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/closures.js")]
extern "C" {
fn works_call(a: &dyn Fn());
fn works_thread(a: &dyn Fn(u32) -> u32) -> u32;
fn cannot_reuse_call(a: &dyn Fn());
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/enums.rs | tests/wasm/enums.rs | use self::inner::ColorWithCustomValues;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/enums.js")]
extern "C" {
fn js_c_style_enum();
fn js_c_style_enum_with_custom_values();
fn js_handle_optional_enums(x: Option<Color>) -> Option<Color>;
fn js_expect_enum(x... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/simple.rs | tests/wasm/simple.rs | use std::ptr::{self, NonNull};
use wasm_bindgen::prelude::*;
use wasm_bindgen::{intern, unintern};
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/simple.js")]
extern "C" {
fn test_add();
fn test_string_arguments();
fn test_return_a_string();
fn test_wrong_types();
fn test_other_expo... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/api.rs | tests/wasm/api.rs | use js_sys::{Uint8Array, WebAssembly};
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/api.js")]
extern "C" {
fn js_works();
fn js_eq_works();
fn assert_null(v: JsValue);
fn debug_values() -> JsValue;
fn assert_function_table(a: JsValue, b: usize);
}
#[w... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/result.rs | tests/wasm/result.rs | use std::fmt;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[derive(Clone, Debug)]
pub enum MyError {
Variant,
InflightShouldBeFalse,
}
// shouldn't technically need this, surely
impl std::error::Error for MyError {}
impl fmt::Display for MyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fm... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/optional_primitives.rs | tests/wasm/optional_primitives.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/optional_primitives.js")]
extern "C" {
fn optional_i32_js_identity(a: Option<i32>) -> Option<i32>;
fn optional_u32_js_identity(a: Option<u32>) -> Option<u32>;
fn optional_isize_js_identity(a: Option<isize>) -> Optio... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/should_panic.rs | tests/wasm/should_panic.rs | #[wasm_bindgen_test]
#[should_panic]
fn should_panic() {
panic!()
}
#[wasm_bindgen_test]
#[should_panic = "error message"]
fn should_panic_string() {
panic!("error message")
}
#[wasm_bindgen_test]
#[should_panic(expected = "error message")]
fn should_panic_expected() {
panic!("error message")
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/struct_vecs.rs | tests/wasm/struct_vecs.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/struct_vecs.js")]
extern "C" {
fn pass_struct_vec();
fn pass_invalid_struct_vec();
}
#[wasm_bindgen]
pub struct ArrayElement;
#[wasm_bindgen]
impl ArrayElement {
#[wasm_bindgen(constructor)]
pub fn new() -> Ar... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/option.rs | tests/wasm/option.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/option.js")]
extern "C" {
pub type MyType;
#[wasm_bindgen(constructor)]
fn new() -> MyType;
fn take_none_byval(t: Option<MyType>);
fn take_some_byval(t: Option<MyType>);
fn return_undef_byval() -> Optio... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/rethrow.rs | tests/wasm/rethrow.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/rethrow.js")]
extern "C" {
fn call_throw_one();
fn call_ok();
}
#[wasm_bindgen_test]
fn err_works() {
call_throw_one();
}
#[wasm_bindgen]
pub fn throw_one() -> Result<u32, JsValue> {
Err(1.into())
}
#[wasm_bi... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/duplicate_deps.rs | tests/wasm/duplicate_deps.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use wasm_bindgen_test_crate_a as a;
use wasm_bindgen_test_crate_b as b;
#[wasm_bindgen(module = "tests/wasm/duplicate_deps.js")]
extern "C" {
fn assert_next_undefined();
fn assert_next_ten();
}
#[wasm_bindgen_test]
fn works() {
assert_next_undefined(... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/inner_self.rs | tests/wasm/inner_self.rs | //! This tests that the `wasm_bindgen` macro produces code that compiles for these use cases.
//! `cargo test --target wasm32-unknown-unknown` will not run if any of these tests breaks.
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct A;
#[wasm_bindgen]
pub struct SelfPortrait;
#[wasm_bindgen]
impl A {
p... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/3944.rs | tests/wasm/3944.rs | #![deny(clippy::mem_forget)]
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
struct Foo2;
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/structural.rs | tests/wasm/structural.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/structural.js")]
extern "C" {
fn js_works();
}
#[wasm_bindgen]
extern "C" {
pub type StructuralFoo;
#[wasm_bindgen(method, structural)]
fn bar(this: &StructuralFoo);
#[wasm_bindgen(method, getter, structur... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/final.rs | tests/wasm/final.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
type Math;
#[wasm_bindgen(static_method_of = Math, final)]
fn log(f: f32) -> f32;
}
#[wasm_bindgen(module = "tests/wasm/final.js")]
extern "C" {
type MyType;
#[wasm_bindgen(constructor, final)]
fn new(x: u32) ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/validate_prt.rs | tests/wasm/validate_prt.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/validate_prt.js")]
extern "C" {
fn js_works();
}
#[wasm_bindgen]
pub struct Fruit {
name: String,
}
#[wasm_bindgen]
impl Fruit {
pub fn name(&self) -> String {
self.name.clone()
}
#[wasm_bindgen(c... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/jscast.rs | tests/wasm/jscast.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/jscast.js")]
extern "C" {
type JsCast1;
#[wasm_bindgen(constructor)]
fn new() -> JsCast1;
#[wasm_bindgen(method)]
fn myval(this: &JsCast1) -> u32;
type JsCast2;
#[wasm_bindgen(constructor)]
fn n... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/main.rs | tests/wasm/main.rs | #![cfg(target_arch = "wasm32")]
#![allow(renamed_and_removed_lints)] // clippy::drop_ref will be renamed to drop_ref
#![allow(clippy::drop_ref, clippy::drop_non_drop)]
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
extern crate wasm_bindgen_test_crate_a;
extern crate wasm_bindgen_test_... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/intrinsics.rs | tests/wasm/intrinsics.rs | //! Tests that some of our more obscure intrinsics work properly.
use std::convert::TryFrom;
use std::fmt::Debug;
use js_sys::{Array, Object, RangeError, Reflect};
use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen_test::wasm_bindgen_test;
// Shorter `JsValue::from(i32)`.
fn int(x: i32) -> JsValue {
JsValue::... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/duplicates.rs | tests/wasm/duplicates.rs | use wasm_bindgen_test::*;
pub mod same_function_different_locations_a {
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "tests/wasm/duplicates_a.js")]
extern "C" {
pub fn foo();
#[wasm_bindgen(thread_local_v2, js_name = bar)]
pub static BAR: JsValue;
}
}
pub mod same_fun... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/variadic.rs | tests/wasm/variadic.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/variadic.js")]
extern "C" {
#[wasm_bindgen(variadic)]
fn variadic_sum_u8(first: u8, second: u8, rest: &[u8]) -> u8;
#[wasm_bindgen(variadic)]
fn variadic_sum_u16(first: u16, second: u16, rest: &[u16]) -> u16;
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/js_objects.rs | tests/wasm/js_objects.rs | use js_sys::JsString;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/js_objects.js")]
extern "C" {
fn simple_foo(s: &JsValue);
fn js_simple();
fn owned_foo(s: JsValue);
fn js_owned();
fn clone_foo1(s: JsValue);
fn clone_foo2(s: &JsValue);
fn cl... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/wasm/usize.rs | tests/wasm/usize.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/usize.js")]
extern "C" {
fn isize_js_identity(a: isize) -> isize;
fn usize_js_identity(a: usize) -> usize;
fn js_works();
}
#[wasm_bindgen]
pub fn usize_zero() -> usize {
0
}
#[wasm_bindgen]
pub fn usize_one()... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/crates/a/src/lib.rs | tests/crates/a/src/lib.rs | extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "tests/wasm/duplicate_deps.js")]
extern "C" {
fn foo();
}
pub fn test() {
foo();
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/tests/crates/b/src/lib.rs | tests/crates/b/src/lib.rs | extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(module = "tests/wasm/duplicate_deps.js")]
extern "C" {
fn foo(x: u32);
}
pub fn test() {
foo(10);
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/benches/js_value_from.rs | benches/js_value_from.rs | use wasm_bindgen::JsValue;
use wasm_bindgen_test::{wasm_bindgen_bench, Criterion};
#[wasm_bindgen_bench]
fn bench_js_value_from(c: &mut Criterion) {
c.bench_function("bench_js_value_from_str", |b| {
b.iter(|| JsValue::from_str("42"));
});
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/ast.rs | crates/macro-support/src/ast.rs | //! A representation of the Abstract Syntax Tree of a Rust program,
//! with all the added metadata necessary to generate Wasm bindings
//! for it.
use crate::{hash::ShortHash, Diagnostic};
use proc_macro2::{Ident, Span};
use std::hash::{Hash, Hasher};
use syn::Path;
use wasm_bindgen_shared as shared;
/// An abstract... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/lib.rs | crates/macro-support/src/lib.rs | //! This crate contains implementation APIs for the `#[wasm_bindgen]` attribute.
#![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro-support/0.2")]
#[macro_use]
mod error;
mod ast;
mod codegen;
mod encode;
mod hash;
mod parser;
use codegen::TryToTokens;
use error::Diagnostic;
pub use parser::BindgenAttrs;
us... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/encode.rs | crates/macro-support/src/encode.rs | use crate::hash::ShortHash;
use proc_macro2::{Ident, Span};
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::env;
use std::fs;
use std::path::PathBuf;
use syn::ext::IdentExt;
use crate::ast;
use crate::Diagnostic;
#[derive(Clone)]
pub enum EncodeChunk {
EncodedBuf(Vec<u8>),
StrExpr(syn:... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/parser.rs | crates/macro-support/src/parser.rs | use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::str::Chars;
use std::{char, iter};
use ast::OperationKind;
use proc_macro2::{Ident, Span, TokenStream, TokenTree};
use quote::ToTokens;
use syn::ext::IdentExt;
use syn::parse::{Parse, ParseStream, Result as SynResult};
use syn::spanned::Spanned;
u... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/error.rs | crates/macro-support/src/error.rs | use proc_macro2::*;
use quote::{ToTokens, TokenStreamExt};
use syn::parse::Error;
/// Provide a Diagnostic with the given span and message
macro_rules! err_span {
($span:expr, $($msg:tt)*) => (
$crate::Diagnostic::spanned_error(&$span, format!($($msg)*))
)
}
/// Immediately fail and return an Err, wit... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/codegen.rs | crates/macro-support/src/codegen.rs | use crate::ast;
use crate::encode;
use crate::encode::EncodeChunk;
use crate::Diagnostic;
use proc_macro2::{Ident, Span, TokenStream};
use quote::format_ident;
use quote::quote_spanned;
use quote::{quote, ToTokens};
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use syn::parse_quote;
use syn::spanned... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/macro-support/src/hash.rs | crates/macro-support/src/hash.rs | //! Common utility function for manipulating syn types and
//! handling parsed values
use std::collections::hash_map::DefaultHasher;
use std::env;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::sync::atomic::AtomicBool;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::SeqCst;
/// Small util... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/test-shared/src/lib.rs | crates/test-shared/src/lib.rs | #![doc(html_root_url = "https://docs.rs/wasm-bindgen-test-shared/0.2")]
#![no_std]
extern crate alloc;
use alloc::string::{String, ToString};
pub fn coverage_path(env: Option<&str>, pid: u32, tmpdir: &str, module_signature: u64) -> String {
let env = env.unwrap_or("default_%m_%p.profraw");
let mut path = St... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/src/lib.rs | crates/js-sys/src/lib.rs | //! Bindings to JavaScript's standard, built-in objects, including their methods
//! and properties.
//!
//! This does *not* include any Web, Node, or any other JS environment
//! APIs. Only the things that are guaranteed to exist in the global scope by
//! the ECMAScript standard.
//!
//! <https://developer.mozilla.or... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/src/Temporal.rs | crates/js-sys/src/Temporal.rs | use super::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = Temporal, extends = Object)]
#[derive(Clone, Debug)]
pub type Instant;
#[wasm_bindgen(static_method_of = Instant, js_namespace = Temporal)]
pub fn from(val: &JsValue) -> Instant;
#[wasm_bindgen(static_method_of = Instant... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/node.rs | crates/js-sys/tests/node.rs | #![cfg(target_arch = "wasm32")]
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_node_experimental);
pub mod common;
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/browser.rs | crates/js-sys/tests/browser.rs | #![cfg(target_arch = "wasm32")]
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
pub mod common;
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/TypedArray.rs | crates/js-sys/tests/wasm/TypedArray.rs | use std::mem::MaybeUninit;
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
macro_rules! each {
($m:ident) => {
$m!(Uint8Array);
$m!(Uint8ClampedArray);
$m!(Uint16Array);
$m!(Uint32Array);
$m!(Int8Array);
$m!(Int16Array);
$m!(Int32Array... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/UriError.rs | crates/js-sys/tests/wasm/UriError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn uri_error() {
let error = UriError::new("msg");
assert!(error.is_instance_of::<UriError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Promise.rs | crates/js-sys/tests/wasm/Promise.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn promise_inheritance() {
let promise = Promise::new(&mut |_, _| ());
assert!(promise.is_instance_of::<Promise>());
assert!(promise.is_instance_of::<Object>());
let _: &Object = promise.as_ref();
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/JsString.rs | crates/js-sys/tests/wasm/JsString.rs | #![cfg(test)]
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/JsString.js")]
extern "C" {
fn new_string_object() -> JsValue;
fn get_replacer_function() -> Function;
}
#[wasm_bindgen_test]
fn js_string_inheritance() {
let string = new_string_objec... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Number.rs | crates/js-sys/tests/wasm/Number.rs | use std::convert::TryFrom;
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Number.js")]
extern "C" {
fn const_epsilon() -> f64;
fn const_max_safe_integer() -> f64;
fn const_max_value() -> f64;
fn const_min_safe_integer() -> f64;
fn const_m... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/WeakMap.rs | crates/js-sys/tests/wasm/WeakMap.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
type SomeKey;
#[wasm_bindgen(method, setter, structural)]
fn set_some(this: &SomeKey, val: JsValue);
}
fn some_key() -> Object {
let key = SomeKey::from(JsValue::from(Object::new()));
key.set_some("... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Reflect.rs | crates/js-sys/tests/wasm/Reflect.rs | #![allow(deprecated)]
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Reflect.js")]
extern "C" {
fn get_char_at() -> Function;
#[wasm_bindgen(js_name = Rectangle)]
static RECTANGLE_CLASS: Function;
#[wasm_bindgen(js_name = Rectangle2)]
st... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/TypeError.rs | crates/js-sys/tests/wasm/TypeError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn type_error() {
let error = TypeError::new("msg");
assert!(error.is_instance_of::<TypeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Set.rs | crates/js-sys/tests/wasm/Set.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
fn set2vec(s: &Set) -> Vec<JsValue> {
let mut result = Vec::new();
s.for_each(&mut |x, _, _| result.push(x));
result
}
#[wasm_bindgen_test]
fn add() {
let set = Set::new(&JsValue::undefined());
set.add(&100.into());
assert_... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/RegExp.rs | crates/js-sys/tests/wasm/RegExp.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn regexp_inheritance() {
let re = RegExp::new(".", "");
assert!(re.is_instance_of::<RegExp>());
assert!(re.is_instance_of::<Object>());
let _: &Object = re.as_ref();
}
#[wasm_bindgen_test]
fn exec() {
let re =... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/DataView.rs | crates/js-sys/tests/wasm/DataView.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn test() {
let bytes = Int8Array::new(&JsValue::from(10));
bytes.set_index(2, 2);
let v = DataView::new(&bytes.buffer(), 2, 8);
assert_eq!(v.byte_offset(), 2);
assert_eq!(v.byte_len... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/EvalError.rs | crates/js-sys/tests/wasm/EvalError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
// Note: This error is not thrown any more, so there are no tests that will generate this error.
// Instead we just have to manually construct it
#[wasm_bindgen_test]
fn new() {
let error = EvalError::new("some message")... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/JSON.rs | crates/js-sys/tests/wasm/JSON.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn parse_array() {
let js_array = JSON::parse("[1, 2, 3]").unwrap();
assert!(Array::is_array(&js_array));
let array = Array::from(&js_array);
assert_eq!(array.length(), 3);
assert_eq!(array.pop(), 3);
a... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/SyntaxError.rs | crates/js-sys/tests/wasm/SyntaxError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn syntax_error() {
let error = SyntaxError::new("msg");
assert!(error.is_instance_of::<SyntaxError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>())... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/SharedArrayBuffer.rs | crates/js-sys/tests/wasm/SharedArrayBuffer.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/SharedArrayBuffer.js")]
extern "C" {
fn is_shared_array_buffer_supported() -> bool;
}
#[wasm_bindgen_test]
fn new() {
if !is_shared_array_buffer_supported() {
return;
}
let x = SharedArra... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/WeakSet.rs | crates/js-sys/tests/wasm/WeakSet.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
type SomeValue;
#[wasm_bindgen(method, setter, structural)]
fn set_some(this: &SomeValue, val: JsValue);
}
fn some_value() -> Object {
let value = SomeValue::from(JsValue::from(Object::new()));
valu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/ArrayBuffer.rs | crates/js-sys/tests/wasm/ArrayBuffer.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn new() {
let x = ArrayBuffer::new(42);
let y: JsValue = x.into();
assert!(y.is_object());
}
#[wasm_bindgen_test]
fn byte_length() {
let buf = ArrayBuffer::new(42);
assert_eq!(buf.by... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Symbol.rs | crates/js-sys/tests/wasm/Symbol.rs | #![cfg(test)]
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Symbol.js")]
extern "C" {
fn test_has_instance(sym: &Symbol);
fn test_is_concat_spreadable(sym: &Symbol);
fn test_iterator(sym: &Symbol);
fn test... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/global_fns.rs | crates/js-sys/tests/wasm/global_fns.rs | use js_sys::*;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn test_decode_uri() {
let x = decode_uri("https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B")
.expect("should decode URI OK");
assert_eq!(String::from(x), "https://mozilla.org/?x=шеллы");
assert!(decode_uri("%E0%A4%A").is_err());
}... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Proxy.rs | crates/js-sys/tests/wasm/Proxy.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Proxy.js")]
extern "C" {
fn proxy_target() -> JsValue;
fn proxy_handler() -> Object;
type Custom;
#[wasm_bindgen(method, getter, structural, catch)]
fn a(this: &Custom) -> Result<u32, JsValue... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/WeakRef.rs | crates/js-sys/tests/wasm/WeakRef.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
type SomeValue;
#[wasm_bindgen(method, setter, structural)]
fn set_some(this: &SomeValue, val: JsValue);
}
fn some_value() -> Object {
let value = SomeValue::from(JsValue::from(Object::new()));
valu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Intl.rs | crates/js-sys/tests/wasm/Intl.rs | use js_sys::*;
use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn get_canonical_locales() {
let locales = Array::new();
locales.push(&"EN-US".into());
locales.push(&"Fr".into());
let locales = JsValue::from(locales);
let canonical_locales = Intl::get_canonical_lo... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Object.rs | crates/js-sys/tests/wasm/Object.rs | #![cfg(test)]
use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
type Foo42;
#[wasm_bindgen(method, setter, structural)]
fn set_foo(this: &Foo42, val: JsValue);
#[wasm_bindgen(thread_local_v2, js_name = prototype, js_namespace = Object)]
static OBJ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/SetIterator.rs | crates/js-sys/tests/wasm/SetIterator.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn entries() {
let s = Set::new(&JsValue::undefined());
s.add(&1.into());
let iter = s.entries();
let obj = iter.next().unwrap();
assert!(!obj.done());
let array = Array::from(&obj.value());
assert_e... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Temporal.rs | crates/js-sys/tests/wasm/Temporal.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Temporal.js")]
extern "C" {
fn is_temporal_supported() -> bool;
}
#[wasm_bindgen_test]
fn now() {
if !is_temporal_supported() {
return;
}
let x = Temporal::Now::plain_date("iso8086");
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/WebAssembly.rs | crates/js-sys/tests/wasm/WebAssembly.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/WebAssembly.js")]
extern "C" {
#[wasm_bindgen(js_name = getWasmArray)]
fn get_wasm_array() -> Uint8Array;
#[wasm_bindgen(js_name = getTableObject)]
fn get_tabl... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Error.rs | crates/js-sys/tests/wasm/Error.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn new() {
let error = Error::new("some message");
assert_eq!(JsValue::from(error.message()), "some message");
}
#[wasm_bindgen_test]
fn new_with_cause() {
let options = Object::new();
Re... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Function.rs | crates/js-sys/tests/wasm/Function.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(thread_local_v2, js_name = max, js_namespace = Math)]
static MAX: Function;
type ArrayPrototype;
#[wasm_bindgen(method, getter, structural)]
pub fn push(this... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/RangeError.rs | crates/js-sys/tests/wasm/RangeError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn range_error() {
let error = RangeError::new("out of range yo");
assert!(error.is_instance_of::<RangeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<O... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/MapIterator.rs | crates/js-sys/tests/wasm/MapIterator.rs | use js_sys::*;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn entries() {
let map = Map::new();
map.set(&"uno".into(), &1.into());
let entries = map.entries();
let next = entries.next().unwrap();
assert!(!next.done());
assert!(next.value().is_object());
assert_eq!(Reflect::get(&next.va... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Generator.rs | crates/js-sys/tests/wasm/Generator.rs | use js_sys::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
#[wasm_bindgen(module = "tests/wasm/Generator.js")]
extern "C" {
fn one_two_generator() -> Generator;
fn dummy_generator() -> Generator;
fn broken_generator() -> Generator;
type GeneratorResult;
#[was... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Array.rs | crates/js-sys/tests/wasm/Array.rs | use js_sys::*;
use std::iter::FromIterator;
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
macro_rules! js_array {
($($e:expr),*) => ({
let __x = Array::new();
$(__x.push(&JsValue::from($e));)*
__x
})
}
macro_rules! array {
($($e:expr),*) => ({
vec![$(JsValue::from... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/ReferenceError.rs | crates/js-sys/tests/wasm/ReferenceError.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn reference_error() {
let error = ReferenceError::new("bad reference, fool");
assert!(error.is_instance_of::<ReferenceError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/main.rs | crates/js-sys/tests/wasm/main.rs | #![cfg(target_arch = "wasm32")]
#![allow(non_snake_case)]
pub mod Array;
pub mod ArrayBuffer;
pub mod ArrayIterator;
pub mod BigInt;
pub mod Boolean;
pub mod DataView;
pub mod Date;
pub mod Error;
pub mod EvalError;
pub mod Function;
pub mod Generator;
pub mod Intl;
pub mod Iterator;
pub mod JSON;
pub mod JsString;
pu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/js-sys/tests/wasm/Date.rs | crates/js-sys/tests/wasm/Date.rs | use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn get_date() {
let date = Date::new(&"August 19, 1975 23:15:30".into());
assert_eq!(date.get_date(), 19);
}
#[wasm_bindgen_test]
fn get_day() {
let date = Date::new(&"August 19, 1975 23:15:3... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.