Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Nov 8, 2023
1 parent 60281a2 commit 06d10a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 11 additions & 5 deletions sea-orm-codegen/src/entity/active_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ impl ActiveEnum {

#[cfg(test)]
mod tests {
use crate::entity::writer::bonus_derive;

use super::*;
use crate::entity::writer::bonus_attributes;
use crate::entity::writer::{bonus_attributes, bonus_derive};
use pretty_assertions::assert_eq;
use sea_query::{Alias, IntoIden};

Expand All @@ -82,7 +80,12 @@ mod tests {
.map(|variant| Alias::new(variant).into_iden())
.collect(),
}
.impl_active_enum(&WithSerde::None, true, &TokenStream::new(), &TokenStream::new())
.impl_active_enum(
&WithSerde::None,
true,
&TokenStream::new(),
&TokenStream::new(),
)
.to_string(),
quote!(
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Copy)]
Expand Down Expand Up @@ -129,7 +132,8 @@ mod tests {
.impl_active_enum(
&WithSerde::None,
true,
&bonus_derive(["specta::Type", "ts_rs::TS"])
&bonus_derive(["specta::Type", "ts_rs::TS"]),
&TokenStream::new(),
)
.to_string(),
build_generated_enum(),
Expand Down Expand Up @@ -164,6 +168,7 @@ mod tests {
.impl_active_enum(
&WithSerde::None,
true,
&TokenStream::new(),
&bonus_attributes([r#"serde(rename_all = "camelCase")"#])
)
.to_string(),
Expand Down Expand Up @@ -195,6 +200,7 @@ mod tests {
.impl_active_enum(
&WithSerde::None,
true,
&TokenStream::new(),
&bonus_attributes([r#"serde(rename_all = "camelCase")"#, "ts(export)"])
)
.to_string(),
Expand Down
7 changes: 6 additions & 1 deletion sea-orm-codegen/src/entity/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ impl EntityWriter {
.enums
.values()
.map(|active_enum| {
active_enum.impl_active_enum(with_serde, with_copy_enums, extra_derives, extra_attributes)
active_enum.impl_active_enum(
with_serde,
with_copy_enums,
extra_derives,
extra_attributes,
)
})
.collect();
Self::write(&mut lines, code_blocks);
Expand Down

0 comments on commit 06d10a7

Please sign in to comment.