Add ignored tests for missing implementations

This commit is contained in:
Gustavo
2024-01-29 16:55:05 -03:00
parent 3667ef65fb
commit 9bc22995cc
+50 -2
View File
@@ -147,8 +147,6 @@ fn generic_struct() {
}
#[test]
// #[ignore]
// https://github.com/Aleph-Alpha/ts-rs/issues/56 TODO
fn inline() {
#[derive(TS)]
struct Generic<T> {
@@ -171,6 +169,56 @@ fn inline() {
);
}
#[test]
#[ignore = "We haven't figured out how to inline generics with bounds yet"]
fn inline_with_bounds() {
#[derive(TS)]
struct Generic<T: ToString> {
t: T,
}
#[derive(TS)]
struct Container {
g: Generic<String>,
#[ts(inline)]
gi: Generic<String>,
#[ts(flatten)]
t: Generic<u32>,
}
assert_eq!(Generic::<&'static str>::decl(), "type Generic<T> = { t: T, }");
assert_eq!(
Container::decl(),
"type Container = { g: Generic<string>, gi: { t: string, }, t: number, }"
// Actual output: { g: Generic<string>, gi: { t: T, }, t: T, }
);
}
#[test]
#[ignore = "We haven't figured out how to inline generics with defaults yet"]
fn inline_with_default() {
#[derive(TS)]
struct Generic<T = String> {
t: T,
}
#[derive(TS)]
struct Container {
g: Generic<String>,
#[ts(inline)]
gi: Generic<String>,
#[ts(flatten)]
t: Generic<u32>,
}
assert_eq!(Generic::<&'static str>::decl(), "type Generic<T = string> = { t: T, }");
assert_eq!(
Container::decl(),
"type Container = { g: Generic<string>, gi: { t: string, }, t: number, }"
// Actual output: { g: Generic<string>, gi: { t: T, }, t: T, }
);
}
#[test]
fn default() {
#[derive(TS)]