Skip to content

Commit

Permalink
[monotouch-test] Fix bool encoding in tests on X64 on Mac Catalyst.
Browse files Browse the repository at this point in the history
    [FAIL] TestTypeEncodings :   xamarin#14
      String lengths are both 1. Strings differ at index 0.
      Expected: "B"
      But was:  "c"
      -----------^

Hopefully this is right?

Ref: d6d02fa
  • Loading branch information
rolfbjarne committed May 4, 2023
1 parent f5a1234 commit b96721c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ObjCRuntime/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ protected string ToSignature (TType type, ObjCMember member, ref bool success, b
case "System.Double": return "d";
case "System.Boolean":
// map managed 'bool' to ObjC BOOL = 'unsigned char' in OSX and 32bit iOS architectures and 'bool' in 64bit iOS architectures
#if MONOMAC
#if MONOMAC || __MACCATALYST__
return IsARM64 ? "B" : "c";
#else
return Is64Bits ? "B" : "c";
Expand Down
4 changes: 1 addition & 3 deletions tests/monotouch-test/ObjCRuntime/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,8 @@ public void TestTypeEncodings ()
{
var cl = new Class (typeof (TestTypeEncodingsClass));
var sig = Runtime.GetNSObject<NSMethodSignature> (Messaging.IntPtr_objc_msgSend_IntPtr (cl.Handle, Selector.GetHandle ("methodSignatureForSelector:"), Selector.GetHandle ("foo::::::::::::::::")));
#if MONOMAC
#if MONOMAC || __MACCATALYST__
var boolEncoding = TrampolineTest.IsArm64CallingConvention ? "B" : "c";
#elif __MACCATALYST__
var boolEncoding = "B";
#else
var boolEncoding = (IntPtr.Size == 8 || TrampolineTest.IsArmv7k || TrampolineTest.IsArm64CallingConvention) ? "B" : "c";

Expand Down

0 comments on commit b96721c

Please sign in to comment.