Skip to content

Commit

Permalink
inline tuple test
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Nov 25, 2023
1 parent 44237ec commit 56fd3d3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ fn typescript_types() {
ExportError::InvalidName(
NamedLocation::Type,
#[cfg(not(windows))]
ExportPath::new_unsafe("tests/ts.rs:613:10"),
ExportPath::new_unsafe("tests/ts.rs:615:10"),
#[cfg(windows)]
ExportPath::new_unsafe("tests\ts.rs:613:10"),
ExportPath::new_unsafe("tests\ts.rs:615:10"),
r#"@odata.context"#.to_string()
)
);
Expand All @@ -285,15 +285,17 @@ fn typescript_types() {
ExportError::InvalidName(
NamedLocation::Type,
#[cfg(not(windows))]
ExportPath::new_unsafe("tests/ts.rs:617:10"),
ExportPath::new_unsafe("tests/ts.rs:619:10"),
#[cfg(windows)]
ExportPath::new_unsafe("tests\ts.rs:617:10"),
ExportPath::new_unsafe("tests\ts.rs:619:10"),
r#"@odata.context"#.to_string()
)
);

// https://github.com/oscartbeaumont/specta/issues/156
assert_ts!(Vec<MyEnum>, r#"({ A: string } | { B: number })[]"#);

assert_ts!(InlineTuple, r#"{ demo: [string, boolean] }"#);
}

#[derive(Type)]
Expand Down Expand Up @@ -618,8 +620,14 @@ pub struct RenameWithWeirdCharsStruct(String);
#[specta(export = false, rename = "@odata.context")]
pub enum RenameWithWeirdCharsEnum {}

#[derive(Serialize, Type)]
#[derive(Type)]
pub enum MyEnum {
A(String),
B(u32),
}

#[derive(Type)]
pub struct InlineTuple {
#[specta(inline)]
demo: (String, bool),
}

0 comments on commit 56fd3d3

Please sign in to comment.