Skip to content

Commit

Permalink
Fix unicode string enum
Browse files Browse the repository at this point in the history
  • Loading branch information
ghsang committed May 10, 2024
1 parent e77cc5f commit e5071d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sea-orm-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc-macro = true
bae = { version = "0.2", package = "sea-bae", default-features = false, optional = true }
syn = { version = "2", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] }
quote = { version = "1", default-features = false }
heck = { version = "0.4", default-features = false }
heck = { version = "0.5", default-features = false }
proc-macro2 = { version = "1", default-features = false }
unicode-ident = { version = "1" }

Expand Down
7 changes: 7 additions & 0 deletions sea-orm-macros/src/derives/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ where
// what guarantees this being special case avoiding
// all potential conflicts.
String::from("__Empty"),
// |s| to_upper_camel_case(&s),
|s| s.to_upper_camel_case(),
);

Expand Down Expand Up @@ -194,5 +195,11 @@ mod tests {
camel_case_with_escaped_non_uax31("1 2 3"),
"_0x310x2020x203"
);

assert_eq!(camel_case_with_escaped_non_uax31("씨오알엠"), "씨오알엠");

assert_eq!(camel_case_with_escaped_non_uax31("A_B"), "A0x5Fb");

assert_eq!(camel_case_with_escaped_non_uax31("AB"), "Ab");
}
}

0 comments on commit e5071d9

Please sign in to comment.