yew icon indicating copy to clipboard operation
yew copied to clipboard

yew_macro test refactoring, extract `...-pass.rs` tests under modules

Open Madoshakalaka opened this issue 4 years ago • 0 comments

Problem

(This is a code quality/refactoring suggestion. I think we need a template for that?)

Currently, the shadowing is repeated in each ...-pass.rs file, that's a lot of duplication and can be extracted into a prelude.

#![no_implicit_prelude]

// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub struct i16;
#[allow(non_camel_case_types)]
pub struct i32;
#[allow(non_camel_case_types)]
pub struct i64;
#[allow(non_camel_case_types)]
pub struct i8;
#[allow(non_camel_case_types)]
pub struct isize;
#[allow(non_camel_case_types)]
pub struct str;
#[allow(non_camel_case_types)]
pub struct u128;
#[allow(non_camel_case_types)]
pub struct u16;
#[allow(non_camel_case_types)]
pub struct u32;
#[allow(non_camel_case_types)]
pub struct u64;
#[allow(non_camel_case_types)]
pub struct u8;
#[allow(non_camel_case_types)]
pub struct usize;

Also, those files currently are executed by try_build and are not parts of the module tree so IDE doesn't provide code analysis. It's hard to compose or edit tests. Extracting them into modules makes it easier.

Questionnaire

  • I would like to fix this

Madoshakalaka avatar Dec 15 '21 06:12 Madoshakalaka