Skip to content

Commit

Permalink
Corrected delegate test
Browse files Browse the repository at this point in the history
  • Loading branch information
thommcgrath committed Dec 1, 2023
1 parent d48b830 commit 0a70295
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Project/Modules/Tests.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,17 @@ Protected Module Tests
Var ClassTarget As Variant = GetDelegateTargetMBS(ClassDelegate)
Var ClassWeak As Boolean = GetDelegateWeakMBS(ClassDelegate)

ClassInstance = Nil
Var UnsafeClassTarget As Variant = GetDelegateTargetMBS(ClassDelegate)
Var UnsafeClassWeak As Boolean = GetDelegateWeakMBS(ClassDelegate)

Call Assert(ModuleTarget.IsNull = True, "Module method delegate has a target when it should not.")
Call Assert(ModuleWeak = False, "Module method delegate is weak but that should not be possible.")

Call Assert(ClassTarget.IsNull = False, "Instance method delegate does not have a target.")
Call Assert(ClassWeak = True, "Instance method delegate is not weak.")

ClassInstance = Nil
ClassTarget = Nil
Var UnsafeClassTarget As Variant = GetDelegateTargetMBS(ClassDelegate)
Var UnsafeClassWeak As Boolean = GetDelegateWeakMBS(ClassDelegate)

Call Assert(UnsafeClassTarget.IsNull = True, "Unsafe instance method delegate has a target.")
Call Assert(UnsafeClassWeak = True, "Unsafe instance method delegate is not weak.")
End Sub
Expand Down

0 comments on commit 0a70295

Please sign in to comment.