use fully qualified names in wasm_bindgen_test for items exported from std prelude (#3549)

* add `#![no_implicit_prelude]` to `test-macro/ui-tests`

* prefix `Some` and `None` with `::core::option::Option`

* fix `test-macro/ui-tests/should_panic.stderr` line numbers

---------

Co-authored-by: Harry Barber <harrybarber@protonmail.com>
This commit is contained in:
Harry Barber
2023-08-07 12:13:35 +01:00
committed by GitHub
parent cd04b27eaa
commit eb36f9d752
3 changed files with 32 additions and 26 deletions

View File

@@ -76,9 +76,11 @@ pub fn wasm_bindgen_test(
let mut tokens = Vec::<TokenTree>::new();
let should_panic = match should_panic {
Some(Some(lit)) => quote! { Some(Some(#lit)) },
Some(None) => quote! { Some(None) },
None => quote! { None },
Some(Some(lit)) => {
quote! { ::core::option::Option::Some(::core::option::Option::Some(#lit)) }
}
Some(None) => quote! { ::core::option::Option::Some(::core::option::Option::None) },
None => quote! { ::core::option::Option::None },
};
let test_body = if r#async {

View File

@@ -1,3 +1,7 @@
#![no_implicit_prelude]
extern crate wasm_bindgen_test_macro;
use wasm_bindgen_test_macro::wasm_bindgen_test;
#[wasm_bindgen_test]

View File

@@ -1,59 +1,59 @@
error: malformed `#[should_panic = "..."]` attribute
--> ui-tests/should_panic.rs:28:15
--> ui-tests/should_panic.rs:32:15
|
28 | #[should_panic::error]
32 | #[should_panic::error]
| ^
error: malformed `#[should_panic]` attribute
--> ui-tests/should_panic.rs:32:18
--> ui-tests/should_panic.rs:36:18
|
32 | #[should_panic = 42]
36 | #[should_panic = 42]
| ^^
error: malformed `#[should_panic = "..."]` attribute
--> ui-tests/should_panic.rs:36:15
|
36 | #[should_panic[]]
| ^^
error: malformed `#[should_panic(...)]` attribute
--> ui-tests/should_panic.rs:40:15
|
40 | #[should_panic(42)]
| ^^^^
40 | #[should_panic[]]
| ^^
error: malformed `#[should_panic(...)]` attribute
--> ui-tests/should_panic.rs:44:15
|
44 | #[should_panic(test)]
| ^^^^^^
44 | #[should_panic(42)]
| ^^^^
error: malformed `#[should_panic(...)]` attribute
--> ui-tests/should_panic.rs:48:15
|
48 | #[should_panic(expected)]
| ^^^^^^^^^^
48 | #[should_panic(test)]
| ^^^^^^
error: malformed `#[should_panic(...)]` attribute
--> ui-tests/should_panic.rs:52:15
|
52 | #[should_panic(expected::error)]
52 | #[should_panic(expected)]
| ^^^^^^^^^^
error: malformed `#[should_panic(...)]` attribute
--> ui-tests/should_panic.rs:56:15
|
56 | #[should_panic(expected::error)]
| ^^^^^^^^^^^^^^^^^
error: malformed `#[should_panic]` attribute
--> ui-tests/should_panic.rs:56:3
--> ui-tests/should_panic.rs:60:3
|
56 | #[should_panic(expected =)]
60 | #[should_panic(expected =)]
| ^^^^^^^^^^^^
error: malformed `#[should_panic]` attribute
--> ui-tests/should_panic.rs:60:27
--> ui-tests/should_panic.rs:64:27
|
60 | #[should_panic(expected = 5)]
64 | #[should_panic(expected = 5)]
| ^
error: duplicate `should_panic` attribute
--> ui-tests/should_panic.rs:65:3
--> ui-tests/should_panic.rs:69:3
|
65 | #[should_panic = "test"]
69 | #[should_panic = "test"]
| ^^^^^^^^^^^^