Skip to content

Commit b6cb935

Browse files
committed
test(rename): add explicit tests for rename
Refs: #420
1 parent 1853406 commit b6cb935

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

crates/macros/src/parsing.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,33 @@ mod tests {
167167

168168
#[test]
169169
fn rename_magic_method() {
170-
for magic in MAGIC_METHOD {
170+
for &(magic, expected) in &[
171+
("__construct", "__construct"),
172+
("__destruct", "__destruct"),
173+
("__call", "__call"),
174+
("__call_static", "__callStatic"),
175+
("__get", "__get"),
176+
("__set", "__set"),
177+
("__isset", "__isset"),
178+
("__unset", "__unset"),
179+
("__sleep", "__sleep"),
180+
("__wakeup", "__wakeup"),
181+
("__serialize", "__serialize"),
182+
("__unserialize", "__unserialize"),
183+
("__to_string", "__toString"),
184+
("__invoke", "__invoke"),
185+
("__set_state", "__set_state"),
186+
("__clone", "__clone"),
187+
("__debug_info", "__debugInfo"),
188+
] {
171189
assert_eq!(magic, magic.rename_method(&RenameRule::None));
172-
assert_eq!(magic, magic.rename_method(&RenameRule::Camel));
173-
assert_eq!(magic, magic.rename_method(&RenameRule::Pascal));
174-
assert_eq!(magic, magic.rename_method(&RenameRule::Snake));
175-
assert_eq!(magic, magic.rename_method(&RenameRule::ScreamingSnakeCase));
190+
assert_eq!(expected, magic.rename_method(&RenameRule::Camel));
191+
assert_eq!(expected, magic.rename_method(&RenameRule::Pascal));
192+
assert_eq!(expected, magic.rename_method(&RenameRule::Snake));
193+
assert_eq!(
194+
expected,
195+
magic.rename_method(&RenameRule::ScreamingSnakeCase)
196+
);
176197
}
177198
}
178199

0 commit comments

Comments
 (0)