aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/decl_check.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/diagnostics/decl_check.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index f987636fe..f179c62b7 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -708,11 +708,23 @@ fn foo() {
708 } 708 }
709 709
710 #[test] 710 #[test]
711 fn incorrect_struct_name() { 711 fn incorrect_struct_names() {
712 check_diagnostics( 712 check_diagnostics(
713 r#" 713 r#"
714struct non_camel_case_name {} 714struct non_camel_case_name {}
715 // ^^^^^^^^^^^^^^^^^^^ Structure `non_camel_case_name` should have CamelCase name, e.g. `NonCamelCaseName` 715 // ^^^^^^^^^^^^^^^^^^^ Structure `non_camel_case_name` should have CamelCase name, e.g. `NonCamelCaseName`
716
717struct SCREAMING_CASE {}
718 // ^^^^^^^^^^^^^^ Structure `SCREAMING_CASE` should have CamelCase name, e.g. `ScreamingCase`
719"#,
720 );
721 }
722
723 #[test]
724 fn no_diagnostic_for_camel_cased_acronyms_in_struct_name() {
725 check_diagnostics(
726 r#"
727struct AABB {}
716"#, 728"#,
717 ); 729 );
718 } 730 }
@@ -728,11 +740,23 @@ struct SomeStruct { SomeField: u8 }
728 } 740 }
729 741
730 #[test] 742 #[test]
731 fn incorrect_enum_name() { 743 fn incorrect_enum_names() {
732 check_diagnostics( 744 check_diagnostics(
733 r#" 745 r#"
734enum some_enum { Val(u8) } 746enum some_enum { Val(u8) }
735 // ^^^^^^^^^ Enum `some_enum` should have CamelCase name, e.g. `SomeEnum` 747 // ^^^^^^^^^ Enum `some_enum` should have CamelCase name, e.g. `SomeEnum`
748
749enum SOME_ENUM
750 // ^^^^^^^^^ Enum `SOME_ENUM` should have CamelCase name, e.g. `SomeEnum`
751"#,
752 );
753 }
754
755 #[test]
756 fn no_diagnostic_for_camel_cased_acronyms_in_enum_name() {
757 check_diagnostics(
758 r#"
759enum AABB {}
736"#, 760"#,
737 ); 761 );
738 } 762 }