@@ -552,7 +552,7 @@ fn theme_add_works() {
552552 // Define a non-default theme
553553 let non_default_theme = Theme {
554554 name : stb ( "doglover" ) ,
555- properties : vec ! [
555+ properties : bvec ! [
556556 ThemeProperty { key: stb( "sound" ) , value: stb( "woof" ) } ,
557557 ThemeProperty { key: stb( "secondary_color" ) , value: stb( "blue" ) } ,
558558 ] ,
@@ -590,7 +590,7 @@ fn theme_add_works() {
590590 // Define a default theme
591591 let default_theme = Theme {
592592 name : stb ( "default" ) ,
593- properties : vec ! [
593+ properties : bvec ! [
594594 ThemeProperty { key: stb( "primary_color" ) , value: stb( "red" ) } ,
595595 ThemeProperty { key: stb( "secondary_color" ) , value: stb( "blue" ) } ,
596596 ] ,
@@ -644,6 +644,7 @@ fn theme_add_works() {
644644}
645645
646646/// Theme add fails when too many properties
647+ #[ should_panic]
647648#[ test]
648649fn theme_add_too_many_properties_fails ( ) {
649650 ExtBuilder :: default ( ) . build ( ) . execute_with ( || {
@@ -656,9 +657,10 @@ fn theme_add_too_many_properties_fails() {
656657 ) ) ;
657658
658659 // Define a default theme with too many properties (10)
660+ // Should panic as properties exceeds mock's max (5)
659661 let default_theme = Theme {
660662 name : stb ( "default" ) ,
661- properties : vec ! [
663+ properties : bvec ! [
662664 ThemeProperty { key: stb( "1" ) , value: stb( "red" ) } ,
663665 ThemeProperty { key: stb( "2" ) , value: stb( "blue" ) } ,
664666 ThemeProperty { key: stb( "3" ) , value: stb( "red" ) } ,
@@ -673,14 +675,12 @@ fn theme_add_too_many_properties_fails() {
673675 inherit : false ,
674676 } ;
675677
676- // Add default theme to base should fail (too many properties)
677- assert_noop ! (
678- RmrkEquip :: theme_add(
679- Origin :: signed( ALICE ) ,
680- 0 , // BaseID
681- default_theme
682- ) ,
683- Error :: <Test >:: TooManyProperties
678+ // We only run this to avoid having to define default_theme's type above
679+ // Otherwise it will fail to compile
680+ RmrkEquip :: theme_add (
681+ Origin :: signed ( ALICE ) ,
682+ 0 , // BaseID
683+ default_theme,
684684 ) ;
685685 } ) ;
686686}
0 commit comments