Skip to content

Commit

Permalink
Improve constant string support in tests.
Browse files Browse the repository at this point in the history
This makes no difference to existing tests, but is needed for the ones
in #138
  • Loading branch information
davidchisnall committed May 2, 2020
1 parent d5973fb commit 049fa3f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Test/Test.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@
#include <assert.h>
#include "Test.h"

@implementation NSConstantString @end
@implementation NSConstantString
- (void)dealloc
{
// Silence a warning
if (0)
{
[super dealloc];
}
}
@end

@interface NSTinyString : NSConstantString @end
@implementation NSTinyString
+ (void)load
{
if (sizeof(void*) > 4)
{
objc_registerSmallObjectClass_np(self, 4);
}
}
- (Class)class { return [NSTinyString class]; }
- (id)retain { return self; }
- (id)autorelease { return self; }
- (void)release {}
@end

@implementation Test
+ (Class)class { return self; }
Expand Down

0 comments on commit 049fa3f

Please sign in to comment.